Example #1
0
function maybeWithdrawButton(ctrl, applicant) {
  if (ctrl.userId === applicant.player.id) return m('a.thin.button', {
    onclick: partial(xhr.withdraw, ctrl)
  }, ctrl.trans('withdraw'));
}
Example #2
0
 resolveIcon : function _poIconView(item) { // Project Organizer doesn't use icons
     if (item.data.attributes.registration){
         return m('i.fa.fa-cube.text-muted-more');
     }
     return m('i.fa.fa-cube');
 },
Example #3
0
 view : function (ctrl, args) {
     return m('.fb-project-organizer#projectOrganizer', ctrl.tb );
 }
 _.map(args.restaurant().opening_hours, (line) => {
   return m(`li.${style['time']}`, line)
 })
Example #5
0
/**
 * Displays date modified
 * @param {Object} item A Treebeard _item object for the row involved. Node information is inside item.data
 * @private
 */
function _poModified(item) {
    var node = item.data;
    var dateString = moment.utc(node.attributes.date_modified).fromNow();
    return m('span', dateString);
}
Example #6
0
function buildCommentElement(comment) {
  return m("div.comment#" + comment.id, [
          m('div.well.well-sm', comment.content)
        ]);
}
Example #7
0
    view: function(ctrl, args) {
        // @TODO: remove all those things from the view
        const project = args.project,
            elapsed = project().elapsed_time,
            remaining = project().remaining_time,
            displayCardClass = () => {
                const states = {
                    waiting_funds: 'card-waiting',
                    successful: 'card-success',
                    failed: 'card-error',
                    draft: 'card-dark',
                    in_analysis: 'card-dark',
                    approved: 'card-dark'
                };

                return (states[project().state] ? `card u-radius zindex-10 ${states[project().state]}` : '');
            },
            displayStatusText = () => {
                const states = {
                    approved: window.I18n.t('display_status.approved', I18nScope()),
                    online: h.existy(project().zone_expires_at) && project().open_for_contributions ? window.I18n.t('display_status.online', I18nScope({ date: h.momentify(project().zone_expires_at) })) : '',
                    failed: window.I18n.t('display_status.failed', I18nScope({ date: h.momentify(project().zone_expires_at), goal: `R$ ${h.formatNumber(project().goal, 2, 3)}` })),
                    rejected: window.I18n.t('display_status.rejected', I18nScope()),
                    in_analysis: window.I18n.t('display_status.in_analysis', I18nScope()),
                    successful: window.I18n.t('display_status.successful', I18nScope({ date: h.momentify(project().zone_expires_at) })),
                    waiting_funds: window.I18n.t('display_status.waiting_funds', I18nScope()),
                    draft: window.I18n.t('display_status.draft', I18nScope())
                };

                return states[project().state];
            },
            isSub = projectVM.isSubscription(project),
            subscriptionData = args.subscriptionData && args.subscriptionData() ? args.subscriptionData() : m.prop(),
            subGoal = isSub ? (_.find(args.goalDetails(), g => g.value > subscriptionData.amount_paid_for_valid_period) || _.last(args.goalDetails()) || { value: '--' }) : null,
            pledged = isSub ? subscriptionData.amount_paid_for_valid_period : project().pledged,
            progress = isSub ? (subscriptionData.amount_paid_for_valid_period / subGoal.value) * 100 : project().progress,
            totalContributors = isSub ? subscriptionData.total_subscriptions : project().total_contributors;

        return m('#project-sidebar.aside', [
            m('.project-stats', [
                m(`.project-stats-inner${isSub ? '.dark' : ''}`, [
                    m('.project-stats-info', [
                        m('.u-marginbottom-20', [
                            m(`#pledged.${isSub ? 'fontsize-larger' : 'fontsize-largest'}.fontweight-semibold.u-text-center-small-only`, [
                                `R$ ${pledged ? h.formatNumber(pledged) : '0'}`,
                                isSub ? m('span.fontsize-large', ' por mês') : null
                            ]),
                            isSub ? m('.fontsize-small.u-text-center-small-only', [
                                window.I18n.t('subscribers_call', I18nScope()),
                                m('span#contributors.fontweight-semibold', window.I18n.t('contributors_count', I18nScope({ count: totalContributors }))),
                            ])
                                : m('.fontsize-small.u-text-center-small-only', [
                                    window.I18n.t('contributors_call', I18nScope()),
                                    m('span#contributors.fontweight-semibold', window.I18n.t('contributors_count', I18nScope({ count: totalContributors }))),
                                    (!project().expires_at && elapsed) ? ` em ${window.I18n.t(`datetime.distance_in_words.x_${elapsed.unit}`, { count: elapsed.total }, I18nScope())}` : ''
                                ])
                        ]),
                        m('.meter', [
                            m('#progressBar.meter-fill', {
                                style: {
                                    width: `${progress}%`
                                }
                            })
                        ]),
                        isSub
                            ? m('.fontsize-smaller.fontweight-semibold.u-margintop-10', `${progress ? parseInt(progress) : '0'}% de R$${subGoal.value} por mês`)
                            : m('.w-row.u-margintop-10', [
                                m('.w-col.w-col-5.w-col-small-6.w-col-tiny-6', [
                                    m('.fontsize-small.fontweight-semibold.lineheight-tighter', `${progress ? parseInt(progress) : '0'}%`)
                                ]),
                                m('.w-col.w-col-7.w-col-small-6.w-col-tiny-6.w-clearfix', [
                                    m('.u-right.fontsize-small.lineheight-tighter', remaining && remaining.total ? [
                                        m('span.fontweight-semibold', remaining.total), window.I18n.t(`remaining_time.${remaining.unit}`, I18nScope({ count: remaining.total }))
                                    ] : '')
                                ])
                            ])
                    ]),
                    m('.w-row', [
                        m.component(projectMode, {
                            project
                        })
                    ])
                ]),
                (project().open_for_contributions && !args.hasSubscription ? m('.back-project-btn-div', [
                    m('.back-project--btn-row', [
                        m('a#contribute_project_form.btn.btn-large.u-marginbottom-20[href="javascript:void(0);"]', {
                            onclick: h.analytics.event({
                                cat: 'contribution_create',
                                act: 'contribution_button_click',
                                project: project()
                            }, ctrl.navigate)

                        }, window.I18n.t(`submit_${project().mode}`, I18nScope()))
                    ]),
                    isSub ? null : m('.back-project-btn-row-right', m.component(projectReminder, {
                        project,
                        type: 'link'
                    }))
                ]) : ''),
                m('.friend-backed-card.project-page', [
                    (!_.isUndefined(project()) && project().contributed_by_friends ? m.component(projectFriends, { project: project(), wrapper: 'div' }) : '')
                ]),
                m(`div[class="fontsize-smaller u-marginbottom-30 ${displayCardClass()}"]`, displayStatusText())
            ]),
            m('.project-share.w-hidden-main.w-hidden-medium', [
                m.component(addressTag, { project }),
                m.component(categoryTag, { project }),
                m('.u-marginbottom-30.u-text-center-small-only',
                    m(`button.btn.btn-inline.btn-medium.btn-terciary${projectVM.isSubscription(project) ? '.btn-terciary-negative' : ''}`, {
                        onclick: ctrl.displayShareBox.toggle
                    }, 'Compartilhar este projeto')
                ),
                ctrl.displayShareBox() ? m(projectShareBox, {
                    project,
                    displayShareBox: ctrl.displayShareBox
                }) : ''
            ]),
            m('.user-c', m.component(projectUserCard, {
                userDetails: args.userDetails,
                isDark: projectVM.isSubscription(project),
                project
            }))
        ]);
    }
 ? _.map(ctrl.tagOptions(), tag => m('.dropdown-link',
     { onclick: ctrl.addTag(tag) },
     m('.fontsize-smaller', tag.name)
 ))
 _.map(ctrl.selectedTags(), choice => m('.tag-div',
     m('div', [
         m('a.tag-close-btn.fa.fa-times-circle', { onclick: ctrl.removeTag(choice) }),
         ` ${choice.name}`
     ]))
Example #10
0
 var username = function(member) {
   var u = member.user;
   return m('span.user_link.ulpt', {
     'data-href': '/@/' + u.name
   }, (u.title ? u.title + ' ' : '') + u.name);
 };
        return m('#basics-tab', [
            (ctrl.showSuccess() ? m.component(popNotification, {
                message: I18n.t('shared.successful_update'),
                toggleOpt: ctrl.showSuccess
            }) : ''),
            (ctrl.showError() ? m.component(popNotification, {
                message: I18n.t('shared.failed_update'),
                toggleOpt: ctrl.showError,
                error: true
            }) : ''),

            // add pop notifications here
            m('form.w-form', { onsubmit: ctrl.onSubmit }, [
                m('.w-container', [
                    // admin fields
                    (args.user.is_admin ?
                      m('.w-row', [
                          m('.w-col.w-col-10.w-col-push-1', [
                              m(inputCard, {
                                  label: I18n.t('tracker_snippet_html', I18nScope()),
                                  children: [
                                      m('textarea.text.optional.w-input.text-field.positive.medium', {
                                          value: vm.fields.tracker_snippet_html(),
                                          onchange: m.withAttr('value', vm.fields.tracker_snippet_html)
                                      })
                                  ]
                              }),
                              m(inputCard, {
                                  label: I18n.t('user_id', I18nScope()),
                                  children: [
                                      m('input.string.optional.w-input.text-field.positive.medium[type="text"]', {
                                          value: vm.fields.user_id(),
                                          onchange: m.withAttr('value', vm.fields.user_id)
                                      })
                                  ]
                              }),
                              m(inputCard, {
                                  label: I18n.t('admin_tags', I18nScope()),
                                  label_hint: I18n.t('admin_tags_hint', I18nScope()),
                                  children: [
                                      m('input.string.optional.w-input.text-field.positive.medium[type="text"]', {
                                          value: vm.fields.admin_tags(),
                                          onchange: m.withAttr('value', vm.fields.admin_tags)
                                      })
                                  ]
                              }),
                              m(inputCard, {
                                  label: I18n.t('service_fee', I18nScope()),
                                  children: [
                                      m('input.string.optional.w-input.text-field.positive.medium[type="number"]', {
                                          value: vm.fields.service_fee(),
                                          onchange: m.withAttr('value', vm.fields.service_fee)
                                      })
                                  ]
                              })
                          ])
                      ])
                     : ''),
                    m('.w-row', [
                        m('.w-col.w-col-10.w-col-push-1', [
                            m(inputCard, {
                                label: I18n.t('name', I18nScope()),
                                label_hint: I18n.t('name_hint', I18nScope()),
                                children: [
                                    m('input.string.required.w-input.text-field.positive.medium[type="text"][maxlength="50"]', {
                                        value: vm.fields.name(),
                                        class: vm.e.hasError('name') ? 'error' : '',
                                        onchange: m.withAttr('value', vm.fields.name)
                                    }),
                                    vm.e.inlineError('name')
                                ]
                            }),
                            m(inputCard, {
                                label: I18n.t('tags', I18nScope()),
                                label_hint: I18n.t('tags_hint', I18nScope()),
                                onclick: () => ctrl.isEditingTags(false),
                                children: [
                                    m('input.string.optional.w-input.text-field.positive.medium[type="text"]', {
                                        config: ctrl.editTag,
                                        class: vm.e.hasError('public_tags') ? 'error' : '',
                                        onfocus: () => vm.e.inlineError('public_tags', false)
                                    }),
                                    ctrl.isEditingTags() ? m('.options-list.table-outer',
                                         ctrl.tagEditingLoading()
                                            ? m('.dropdown-link', m('.fontsize-smallest', 'Carregando...'))
                                            : ctrl.tagOptions().length
                                                ? _.map(ctrl.tagOptions(), tag => m('.dropdown-link',
                                                    { onclick: ctrl.addTag(tag) },
                                                    m('.fontsize-smaller', tag.name)
                                                ))
                                                : m('.dropdown-link', m('.fontsize-smallest', 'Nenhuma tag relacionada...'))
                                    ) : '',
                                    vm.e.inlineError('public_tags'),
                                    m('div.tag-choices',
                                        _.map(ctrl.selectedTags(), choice => m('.tag-div',
                                            m('div', [
                                                m('a.tag-close-btn.fa.fa-times-circle', { onclick: ctrl.removeTag(choice) }),
                                                ` ${choice.name}`
                                            ]))
                                        )
                                    )
                                ]
                            }),
                            m(inputCard, {
                                label: I18n.t('permalink', I18nScope()),
                                label_hint: I18n.t('permalink_hint', I18nScope()),
                                children: [
                                    m('.w-row', [
                                        m('.w-col.w-col-4.w-col-small-6.w-col-tiny6.text-field.prefix.no-hover.medium.prefix-permalink', {
                                            class: vm.e.hasError('permalink') ? 'error' : ''
                                        },
                                          m('.fontcolor-secondary.u-text-center.fontcolor-secondary.u-text-center.fontsize-smallest', 'www.catarse.me/')),
                                        m('.w-col.w-col-8.w-col-small-6.w-col-tiny-6', [
                                            m('input.string.required.w-input.text-field.postfix.positive.medium[type="text"]', {
                                                value: vm.fields.permalink(),
                                                class: vm.e.hasError('permalink') ? 'error' : '',
                                                onchange: m.withAttr('value', vm.fields.permalink)
                                            }),
                                        ]),
                                    ]),
                                    m('.w-row', vm.e.inlineError('permalink'))
                                ]
                            }),
                            m(inputCard, {
                                label: I18n.t('category', I18nScope()),
                                label_hint: I18n.t('category_hint', I18nScope()),
                                children: [
                                    m('select.required.w-input.text-field.w-select.positive.medium', {
                                        value: vm.fields.category_id(),
                                        class: vm.e.hasError('category_id') ? 'error' : '',
                                        onchange: m.withAttr('value', vm.fields.category_id)
                                    }, ctrl.categories()),
                                    vm.e.inlineError('category_id')
                                ]
                            }),
                            m(inputCard, {
                                label: I18n.t('city', I18nScope()),
                                label_hint: I18n.t('city_hint', I18nScope()),
                                children: [
                                    m('input.string.required.w-input.text-field.positive.medium[type="text"]', {
                                        value: vm.fields.city_name(),
                                        class: vm.e.hasError('city_id') ? 'error' : '',
                                        onkeyup: vm.generateSearchCity(ctrl.cities)
                                    }),
                                    vm.e.inlineError('city_id'),
                                    ctrl.cities()
                                ]
                            })
                        ])
                    ])
                ]),
                m(projectEditSaveBtn, { loading: ctrl.loading, onSubmit: ctrl.onSubmit })
            ])
        ]);
Example #12
0
  view: function(ctrl) {

    var username = function(member) {
      var u = member.user;
      return m('span.user_link.ulpt', {
        'data-href': '/@/' + u.name
      }, (u.title ? u.title + ' ' : '') + u.name);
    };

    var statusIcon = function(member) {
      var contrib = member.role === 'w';
      return m('span', {
        class: classSet({
          contrib: contrib,
          active: ctrl.members.isActive(member.user.id),
          online: ctrl.members.isOnline(member.user.id),
          status: true
        }),
        title: contrib ? 'Contributor' : 'Viewer',
      }, m('i', {
        'data-icon': contrib ? '' : 'v'
      }));
    };

    var configButton = function(member, confing) {
      if (!ctrl.members.isOwner() || member.user.id === ctrl.members.myId) return null;
      return m('span.action.config', {
        onclick: function() {
          ctrl.members.confing(confing ? null : member.user.id);
        }
      }, m('i', {
        'data-icon': '%'
      }));
    };

    var memberConfig = function(member) {
      return m('div.config', {
        key: member.user.id + '-config',
        config: function(el, isUpdate) {
          if (!isUpdate) $(el).parent('.members').scrollTo(el, 200);
        }
      }, [
        (function(id) {
          return m('div.role', [
            m('div.switch', [
              m('input', {
                id: id,
                class: 'cmn-toggle cmn-toggle-round',
                type: 'checkbox',
                checked: member.role === 'w',
                onchange: function(e) {
                  ctrl.members.setRole(member.user.id, e.target.checked ? 'w' : 'r');
                }
              }),
              m('label', {
                'for': id
              })
            ]),
            m('label', {
              'for': id
            }, 'Contributor')
          ]);
        })('member-role'),
        m('div.kick', m('a.button.text[data-icon=L]', {
          onclick: partial(ctrl.members.kick, member.user.id)
        }, 'Kick from this study'))
      ]);
    };

    return [
      m('div', {
        key: 'members',
        class: 'list members',
        config: function() {
          $('body').trigger('lichess.content_loaded');
        }
      }, ctrl.members.ordered().map(function(member) {
        var confing = ctrl.members.confing() === member.user.id;
        var attrs = {
          key: member.user.id,
          class: classSet({
            elem: true,
            member: true,
            editing: confing
          })
        };
        return [
          m('div', attrs, [
            m('div.left', [
              statusIcon(member),
              username(member)
            ]),
            configButton(member, confing)
          ]),
          confing ? memberConfig(member) : null
        ];
      })),
      ctrl.members.isOwner() ? m('i.add[data-icon=0]', {
        title: 'Invite someone',
        'data-icon': 'O',
        onclick: ctrl.members.inviteForm.toggle
      }) : null
    ];
  }
Example #13
0
    view: function(ctrl) {
        if (!ctrl.loaded) {
            return util.Spinner;
        }
        return m('.editor-pane.panel-body', [
            m('.wiki-connected-users', m('.row', m('.col-sm-12', [
                m('.ul.list-inline', {style: {'margin-top': '10px'}}, [
                    ctrl.observables.activeUsers().map(function(user) {
                        return m('li', m('a', {href: user.url}, [
                            m('img', {
                                title: user.name,
                                src: user.gravatar,
                                'data-container': 'body',
                                'data-placement': 'top',
                                'data-toggle': 'tooltip',
                                style: {border: '1px solid black'}
                            })
                        ]));
                    })

                ])
            ]))),
            m('', {style: {'padding-top': '10px'}}, [
                m('.wmd-input.wiki-editor#editor', {config: ctrl.bindAce})
            ]),
            m('br'),
            m('[style=position:inherit]', [
                m('.row', m('.col-sm-12', [
                    m('.pull-right', [
                        m('button#fileEditorRevert.btn.btn-sm.btn-danger', {onclick: function(){ctrl.reloadFile();}}, 'Revert'),
                        ' ',
                        m('button#fileEditorSave.btn.btn-sm.btn-success', {onclick: function() {ctrl.saveFile();}}, 'Save')
                    ])
                ]))
            ])
        ]);

    }
Example #14
0
 view: function(ctrl, args) {
   return m('.footer', 'Footer');
 }
Example #15
0
    view: function(ctrl, args) {
        const showSuccess = ctrl.showSuccess,
            error = ctrl.error;
        return m('.w-container',
            m('.w-row', [
                (ctrl.showSuccess() ? m.component(popNotification, {
                    message: 'Meta salva com sucesso'
                }) : ''),
                (ctrl.error() ? m.component(popNotification, {
                    message: 'Erro ao salvar informações',
                    error: true
                }) : ''),

                m('.w-col.w-col-8',
                    m('.w-form', [
                        ctrl.e.inlineError('goals'),
                        m('div',
                            m(".card.card-terciary.medium.u-marginbottom-30[id='arrecadacao']", [
                                m('.u-marginbottom-30', [
                                    m("label.fontsize-base.fontweight-semibold[for='name-8']",
                                        'O que você vai alcançar com os pagamentos mensais de seus assinantes?'
                                    ),
                                    m('.fontsize-smaller', [
                                        'As metas mensais são a melhor maneira de informar aos seus assinantes como os recursos arrecadados mensalmente serão usados e o que vocês estão conquistando juntos.',
                                        m.trust(' '),
                                        'Você pode alterar suas metas a qualquer momento durante sua campanha.'
                                    ])
                                ]),
                                _.map(ctrl.goals(), (goal) => {
                                    if (goal().editing()) {
                                        return m(projectGoalEditCard, {
                                            goal,
                                            showSuccess,
                                            project: args.project,
                                            currentGoal: ctrl.currentGoal,
                                            error
                                        });
                                    }
                                    return m(projectGoalCard, {
                                        goal
                                    });
                                }),
                                m('button.btn.btn-large.btn-message', {
                                    onclick: () => {
                                        ctrl.addGoal(args.projectId);
                                    }
                                }, [
                                    '+ ',
                                    m.trust(' '),
                                    ' Adicionar meta mensal'
                                ])
                            ])
                        )
                    ])
                ),
                m('.w-col.w-col-4',
                  m('.card.u-radius',
                      [
                          m('.fontsize-small.u-marginbottom-20',
                              [
                                  m('span.fa.fa-lightbulb-o.fa-lg'),
                                  m.trust(' '),
                                  'Dicas'
                              ]
                      ),
                          m('ul.w-list-unstyled',
                              [
                                  m('li.u-marginbottom-10',
                            m('a.fontsize-smaller.alt-link[href="https://suporte.catarse.me/hc/pt-br/articles/115005632746-Catarse-Assinaturas-FAQ-Realizadores#meta_inicial"][target="_blank"]',
                              'O que é a meta mensal inicial?'
                            )
                          ),
                                  m('li.u-marginbottom-10',
                            m('a.fontsize-smaller.alt-link[href="https://suporte.catarse.me/hc/pt-br/articles/115005632746-Catarse-Assinaturas-FAQ-Realizadores#meta_futura"][target="_blank"]',
                              'O que são as metas mensais futuras?'
                            )
                          ),
                                  m('li.u-marginbottom-10',
                            m('a.fontsize-smaller.alt-link[href="https://suporte.catarse.me/hc/pt-br/articles/115005632746-Catarse-Assinaturas-FAQ-Realizadores#meta_atual"][target="_blank"]',
                              'O que é a meta mensal atual?'
                            )
                          ),
                                  m('li.u-marginbottom-10',
                            m('a.fontsize-smaller.alt-link[href="https://suporte.catarse.me/hc/pt-br/articles/115005632746-Catarse-Assinaturas-FAQ-Realizadores#nova_meta"][target="_blank"]',
                              'Posso adicionar novas metas depois do lançamento?'
                            )
                          ),
                                  m('li.u-marginbottom-10',
                            m('a.fontsize-smaller.alt-link[href="https://suporte.catarse.me/hc/pt-br/articles/115005632746-Catarse-Assinaturas-FAQ-Realizadores#nao_atingir"][target="_blank"]',
                              'O que acontece se eu não atingir a meta do meu projeto?'
                            )
                          )
                              ]
                      )
                      ]
                  )
                )
            ])
        );
    }
Example #16
0
//     provides: 'black',
//     total_cost: 3 }
const Card = {
  controller () {
    const ctrl = this;
    ctrl.onClick = (card) => {
      B.do({
        action: 'gameaction/pick-card',
        card: card,
      });
    };
  },
  view (ctrl, card) {
    if(card.status == 'empty') {
      return m('.Card', {
        key: `card${card.key}`,
      });
    }
    return m('.Card', {
      key: `card${card.key}`,
      onclick: ctrl.onClick.bind(ctrl, card),
      className: card.affordable ? 'affordable' : '',
    }, [
      (function() {
        if(card.points > 0) {
          return m('.Points', card.points);
        }
      })(),
      m('.Provide.' + card.provides),
      m('.Cost', colors.filter(color => {
        return (card[color] > 0);
Example #17
0
var m = require('mithril');
var util = require('../util');
var arrow = util.arrow;

module.exports = {
  key: 'queen',
  title: 'The queen',
  subtitle: 'Queen = rook + bishop',
  image: util.assetUrl + 'images/learn/pieces/Q.svg',
  intro: 'Enters the most powerful chess piece. Her majesty the queen!',
  illustration: m('div.is2d.no-square',
    m('piece.queen.white')
  ),
  levels: [{
    goal: 'Grab all the stars!',
    fen: '8/8/8/8/8/8/4Q3/8 w - - 0 1',
    apples: 'e5 b8',
    nbMoves: 2,
    shapes: [arrow('e2e5'), arrow('e5b8')]
  }, {
    goal: 'Grab all the stars!',
    fen: '8/8/8/8/3Q4/8/8/8 w - - 0 1',
    apples: 'a3 f2 f8 h3',
    nbMoves: 4
  }, {
    goal: 'Grab all the stars!',
    fen: '8/8/8/8/2Q5/8/8/8 w - - 0 1',
    apples: 'a3 d6 f1 f8 g3 h6',
    nbMoves: 6
  }, {
    goal: 'Grab all the stars!',
Example #18
0
 (function() {
   if(card.points > 0) {
     return m('.Points', card.points);
   }
 })(),
Example #19
0
var renderLayerItem = function (ctrl, treeItem) {
    // group layer handler
    var item = ctrl.vm.layers[treeItem.item_uuid()];
    var properties = {
        onmouseenter: ctrl.vm.ev_mouseOver.bind(ctrl, item),
        onmouseleave: ctrl.vm.ev_mouseOut.bind(ctrl, item)
    };

    return m('div.layer', properties, [
        m('div.layer-control', {
            'class': item.visible() ? '' : 'deactivated',
            onclick: ctrl.vm.ev_layerToggle.bind(ctrl, item)
        }, [
            m('i.fa.fa-eye')
        ]),
        m('div.layer-control', {
            'class': item.query() ? '' : 'deactivated',
            onclick: ctrl.vm.ev_queryLayerToggle.bind(ctrl, item)
        }, [
            m('i.fa.fa-info-circle')
        ]),
        m('div.layer-name', [item.name()]),

        m('div.layer-control.layer-settings-control', {
            'class': item.showLayerControl() ? '' : 'hide',
            onclick: ctrl.vm.ev_toggleShowControl.bind(ctrl, item)
        }, [
            m('i', {
                'class': 'fa fa-cog'
            })
        ]),
        m('div.layer-details', {
            'class': item.showLayerDetails() ? '' : 'hide'
        }, [
            m('span', {}, 'TRANSPARENTNOST: '),
            m('input[type=range]', {
                value: item.transparency(),
                onchange: ctrl.vm.ev_layerTransparency.bind(ctrl, item)
            }),
            m('img.legend', {
                src: ctrl.vm.loadLegend(item)
            })
        ])
    ]);
};
Example #20
0
 }).map(color => {
   return m('.Row', [
     m('.Indicator.' + color),
     m('.Count', card[color]),
   ]);
 })),
    return m(`.${style['photo']}`, [
        m(`.${style['details']}`, { style: setStyle() }, [
          // m(`.${style['ptoto']}`, { style: getPhotoStyle.call(null, args.dimensions) }),

          // HEADER
          m(`.${style['header']}`, { style: { opacity: 0 }, class: ctrl.hoursOpen() ? 'open' : '', config: headerConfig }, [
            m(`.${style['line-one']}`, [
              m('h3', 'Reviews'),
              m(`.${style['header-opening-hours']}`, { onclick: toggleHoursSection.bind(null, ctrl.hoursOpen) } ,[
                m('h3', 'Opening Hours'),
                m(`.${style['down-arrow']}`, { class: ctrl.hoursOpen() ? 'open' : '' }, downArrowIcon)
              ])
            ]),
            m(`.${style['opening-hours-section']}`, { class: ctrl.hoursOpen() ? 'visible' : '' } ,[
              m(`ul.${style['opening-hours']}`, [
                _.map(args.restaurant().opening_hours, (line) => {
                  return m(`li.${style['time']}`, line)
                })
              ]),
              m(`.${style['clear']}`)
            ])
          ]),


          ctrl.writingSectionActive() ? m.component(Writing, {
            review: ctrl.review,
            writingActive: ctrl.writingSectionActive
          }) :
            
            //REVIEWS
            m(`.${style['reviews']}`, [
              m(`ul.${style['reviews-container']}`, { config: reviewItemConfig } ,[
                _.map(args.restaurant().reviews, (review) => {
                  return renderReview(review)
                }),
                _.map(ctrl.indexDBReviews(), (review) => {
                  return renderReview(review, true)
                })
              ])
            ]),

          m(`.${style['close-button']}`, { onclick: closeButtonHandler.bind(args) }),
          m(`.${style['close-icon']}`, closeIcon),


          //FAB
          ctrl.detailsOpen() ? m(`.${style['writing-fab']}`, [
            ctrl.review().valid() ? writingMainActionButton.call(ctrl, 'done') : writingMainActionButton.call(ctrl, 'edit'),
            // cancel fab is displaying with little delay, 
            // set in config
            ctrl.writingSectionActive() ? m('', { config: cancelButtonConfig, style: { opacity: 0 } }, cancelActionButton.call(ctrl)) : ''
          ]) : ''
        ])
      ])
Example #22
0
 ctrl.vm.variants.map(function(v) {
   return m('option', {
     value: v.key
   }, v.name)
 })),
    view: function(ctrl, args) {
        const 
            designComponent = ctrl.designStates[args.current_state()],
            processingComponent = designComponent.processing,
            successComponent = designComponent.success;

        return m('.project-progress-bar', [
            m('.project-progress-bar-step',
                m('.project-progress-bar-content', [
                    m('.project-progress-bar-circle.done.fa.fa-check.fa-2x'),
                    m('.project-progress-bar-description.fontcolor-terciary', [
                        m('.fontsize-smaller.lineheight-tight.fontweight-semibold',
                            I18n.t('finished_initial', I18nScope())
                        ),
                        m('.fontsize-smallest',
                            `${I18n.t('finished_initial_subtitle', I18nScope())} ${h.momentify(args.project().expires_at,'DD/MM/YYYY')}`
                        )
                    ])
                ])
            ),
            m(`.project-progress-bar-line${processingComponent.lineClass}`),
            m('.project-progress-bar-step',
                m('.project-progress-bar-content', [
                    m(`.project-progress-bar-circle${processingComponent.circleClass}`),
                    m(`.project-progress-bar-description${processingComponent.descriptionTextClass}`, [
                        m(`.fontsize-smaller.lineheight-tight.fontweight-semibold${processingComponent.descriptionTextSizeClass}`,
                            I18n.t('finished_processing', I18nScope())
                        ),
                        m('.fontsize-smallest',
                            processingComponent.text
                        )
                    ])
                ])
            ),
            m(`.project-progress-bar-line${successComponent.lineClass}`),
            m('.project-progress-bar-step',
                m('.project-progress-bar-content', [
                    m(`.project-progress-bar-circle${successComponent.circleClass}`),
                    m(`.project-progress-bar-description${successComponent.descriptionTextClass}`, [
                        m(`.fontsize-smaller.lineheight-tight.fontweight-semibold${successComponent.descriptionTextSizeClass}`,
                            I18n.t('finished_withdraw', I18nScope())
                        ),
                        m('.fontsize-smallest',
                            successComponent.text
                        )
                    ])
                ])
            )
        ]);
    }
Example #24
0
 m('select#chapter-orientation', ['White', 'Black'].map(function(color) {
   return m('option', {
     value: color.toLowerCase()
   }, color)
 })),
Example #25
0
 custom : function (row){
     return m('.btn.btn-default.btn-sm[data-toggle="modal"][data-target="#infoModal"]', {
     }, m('i.fa.fa-ellipsis-h', {onclick: function() {
         $osf.trackClick('myProjects', 'mobile', 'open-information-panel');
     }}));
 }
Example #26
0
 m('select#chapter-conceal', concealChoices.map(function(c) {
   return m('option', {
     value: c[0]
   }, c[1])
 })),
Example #27
0
 resolveRefreshIcon : function () {
     return m('i.fa.fa-refresh.fa-spin');
 }, naturalScrollLimit : 0,
Example #28
0
  view: function(ctrl) {

    var activeTab = ctrl.vm.tab();
    var makeTab = function(key, name, title) {
      return m('a.hint--top', {
        class: key + (activeTab === key ? ' active' : ''),
        'data-hint': title,
        onclick: partial(ctrl.vm.tab, key),
      }, name);
    };
    var fieldValue = function(e, id) {
      var el = e.target.querySelector('#chapter-' + id);
      return el ? el.value : null;
    };
    var gameOrPgn = activeTab === 'game' || activeTab === 'pgn';

    return dialog.form({
      onClose: ctrl.close,
      content: [
        activeTab === 'edit' ? null : m('h2', 'New chapter'),
        m('form.material.form', {
          onsubmit: function(e) {
            ctrl.submit({
              name: fieldValue(e, 'name'),
              game: fieldValue(e, 'game'),
              variant: fieldValue(e, 'variant'),
              fen: fieldValue(e, 'fen') || (activeTab === 'edit' ? ctrl.vm.editorFen() : null),
              pgn: fieldValue(e, 'pgn'),
              orientation: fieldValue(e, 'orientation'),
              conceal: !!fieldValue(e, 'conceal')
            });
            e.stopPropagation();
            return false;
          }
        }, [
          m('div.form-group', [
            m('input#chapter-name', {
              required: true,
              minlength: 2,
              maxlength: 80,
              config: function(el, isUpdate) {
                if (!isUpdate && !el.value) {
                  el.value = 'Chapter ' + (ctrl.initial() ? 1 : (ctrl.chapters().length + 1));
                  el.select();
                  el.focus();
                }
              }
            }),
            m('label.control-label[for=chapter-name]', 'Name'),
            m('i.bar')
          ]),
          m('div.study_tabs', [
            makeTab('init', 'Init', 'Start from initial position'),
            makeTab('edit', 'Edit', 'Start from custom position'),
            makeTab('game', 'game', 'Load a lichess game'),
            makeTab('fen', 'FEN', 'Load a FEN position'),
            makeTab('pgn', 'PGN', 'Load a PGN game')
          ]),
          activeTab === 'edit' ? m('div.editor_wrap', {
            config: function(el, isUpdate, ctx) {
              if (isUpdate) return;
              $.when(
                lichess.loadScript('/assets/compiled/lichess.editor.js'),
                $.get('/editor.json', {
                  fen: ctrl.root.vm.node.fen
                })
              ).then(function(a, b) {
                var data = b[0];
                data.embed = true;
                data.options = {
                  inlineCastling: true,
                  onChange: function(fen) {
                    ctrl.vm.editorFen(fen);
                    m.redraw();
                  }
                };
                var editor = LichessEditor(el, data);
                ctrl.vm.editorFen(editor.getFen());
              });
            }
          }, m.trust(lichess.spinnerHtml)) : null,
          activeTab === 'game' ? m('div.form-group', [
            m('input#chapter-game', {
              placeholder: 'Game ID or URL'
            }),
            m('label.control-label[for=chapter-game]', 'From played or imported game'),
            m('i.bar')
          ]) : null,
          activeTab === 'fen' ? m('div.form-group.no-label', [
            m('input#chapter-fen', {
              placeholder: 'Initial FEN position'
            }),
            m('i.bar')
          ]) : null,
          activeTab === 'pgn' ? m('div.form-group.no-label', [
            m('textarea#chapter-pgn', {
              placeholder: 'Paste your PGN here, one game only'
            }),
            m('i.bar')
          ]) : null,
          m('div', [
            m('div.form-group.half', [
              m('select#chapter-variant', {
                  disabled: gameOrPgn
                }, gameOrPgn ? [
                  m('option', 'Automatic')
                ] :
                ctrl.vm.variants.map(function(v) {
                  return m('option', {
                    value: v.key
                  }, v.name)
                })),
              m('label.control-label[for=chapter-variant]', 'Variant'),
              m('i.bar')
            ]),
            m('div.form-group.half', [
              m('select#chapter-orientation', ['White', 'Black'].map(function(color) {
                return m('option', {
                  value: color.toLowerCase()
                }, color)
              })),
              m('label.control-label[for=chapter-orientation]', 'Orientation'),
              m('i.bar')
            ])
          ]),
          gameOrPgn ? m('div.form-group', [
            m('select#chapter-conceal', concealChoices.map(function(c) {
              return m('option', {
                value: c[0]
              }, c[1])
            })),
            m('label.control-label[for=chapter-conceal]', 'Progressive move display'),
            m('i.bar')
          ]) : null,
          dialog.button('Create chapter')
        ])
      ]
    });
  }
Example #29
0
    view: function(ctrl, args) {
        const comment_html = args.comment_html(),
            title = args.title(),
            recipientsText = args.recipients === 'rewards' ?
                m('.fontsize-small.u-marginbottom-30', [
                    `A novidade acima será enviada por email para os ${args.confirmationLabel} de `,
                    m('span.fontweight-semibold', args.rewardText),
                    ' e ficará ',
                    m('span.fontweight-semibold', window.I18n.t(`backers_only_${args.mode}`, I18nScope()))
                ]) 
            :
                args.recipients === 'backers' ?
                    m('.fontsize-small.u-marginbottom-30', [
                        m('span', ' A novidade acima será  '),
                        m('span.fontweight-semibold', window.I18n.t(`email_backers_${args.mode}`, I18nScope())),
                        m('span', ' e ficará '),
                        m('span.fontweight-semibold', 'visível somente para esses na plataforma.')
                    ]) 
                :
                    m('.fontsize-small.u-marginbottom-30', [
                        'A novidade acima será  ',
                        m('span.fontweight-semibold', 'enviada por email para todos'),
                        window.I18n.t(`all_backers_${args.mode}`, I18nScope()),
                        m('span.fontweight-semibold', 'visível publicamente '),
                        'na plataforma.'
                    ]);

        return (
            ctrl.isLoading() ? h.loader() : 
            m('div', [
                m('.dashboard-header.u-text-center',
                    m('.w-container',
                        m('.w-row', [
                            m('.w-col.w-col-3'),
                            m('.w-col.w-col-6',
                                m('.fontsize-larger.fontweight-semibold.lineheight-tight',
                                    'Revise sua novidade antes de enviar!'
                                )
                            ),
                            m('.w-col.w-col-3')
                        ])
                    )
                ),
                m('.section', [
                    m('.w-container',
                        m('.card.u-marginbottom-60.u-radius.w-row', [
                            m('.w-col.w-col-1'),
                            m('.u-marginbottom-30.u-margintop-30.w-col.w-col-10.w-hidden-small.w-hidden-tiny', [
                                m('.fontcolor-secondary.fontsize-small.u-text-center',
                                    moment().format('DD/MM/YYYY')
                                ),
                                m('.fontsize-larger.fontweight-semibold.u-marginbottom-30.u-text-center',
                                    title
                                ),
                                m('.fontsize-base', m.trust(comment_html))
                            ]),
                            m('.w-col.w-col-1')
                        ])
                    ),
                    m('.w-row', [
                        m('.w-col.w-col-3'),
                        m('.w-col.w-col-6',
                            recipientsText
                        ),
                        m('.w-col.w-col-3')
                    ]),
                    m('.u-marginbottom-20.w-row', [
                        m('.w-col.w-col-3'),
                        m('.w-sub-col.w-col.w-col-4',
                            m('button.btn.btn-large', {
                                onclick: ctrl.sendNotification
                            }, [
                                m('span.fa.fa-paper-plane',
                                    ''
                                ),
                                ' ',
                                m.trust(' '),
                                'Enviar'
                            ])
                        ),
                        m('.w-col.w-col-2',
                            m('button.btn.btn-large.btn-terciary', {
                                onclick: ctrl.togglePreview
                            },
                                'Editar'
                            )
                        ),
                        m('.w-col.w-col-3')
                    ])
                ])
            ])
        );
    }
Example #30
0
module.exports = function(ctrl) {
  var candidates = simul.candidates(ctrl).sort(byRating);
  var accepted = simul.accepted(ctrl).sort(byRating);
  var isHost = simul.createdByMe(ctrl);
  return [
    ctrl.userId ? (
      simul.createdByMe(ctrl) ? (accepted.length > 1 ?
        m('a.button.top_right.text.active', {
          'data-icon': 'G',
          onclick: partial(xhr.start, ctrl)
        }, 'Start') : m('a.button.top_right.text', {
          'data-icon': 'L',
          onclick: function() {
            if (confirm('Delete this simul?')) xhr.abort(ctrl);
          }
        }, ctrl.trans('cancel'))
      ) : (
        simul.containsMe(ctrl) ? m('a.button.top_right', {
          onclick: partial(xhr.withdraw, ctrl)
        }, ctrl.trans('withdraw')) : m('a.button.top_right.text', {
            'data-icon': 'G',
            onclick: function() {
              if (ctrl.data.variants.length === 1)
                xhr.join(ctrl.data.variants[0].key)(ctrl);
              else {
                $.modal($('#simul .join_choice'));
                $('#modal-wrap .join_choice a').click(function() {
                  $.modal.close();
                  xhr.join($(this).data('variant'))(ctrl);
                });
              }
            }
          },
          ctrl.trans('join'))
      )) : null,
    util.title(ctrl),
    simul.acceptedContainsMe(ctrl) ? m('div.instructions',
      'You have been selected! Hold still, the simul is about to begin.'
    ) : (
      (simul.createdByMe(ctrl) && ctrl.data.applicants.length < 6) ? m('div.instructions',
        'Share this page URL to let people enter the simul!'
      ) : null
    ),
    m('div.halves',
      m('div.half.candidates',
        m('table.slist.user_list',
          m('thead', m('tr', m('th', {
            colspan: 3
          }, [
            m('strong', candidates.length),
            ' candidate players'
          ]))),
          m('tbody', candidates.map(function(applicant) {
            var variant = util.playerVariant(ctrl, applicant.player);
            return m('tr', {
              key: applicant.player.id,
              class: ctrl.userId === applicant.player.id ? 'me' : ''
            }, [
              m('td', util.player(applicant.player)),
              m('td.variant.text', {
                'data-icon': variant.icon
              }, variant.name),
              m('td.action', isHost ? m('a.button.text', {
                'data-icon': 'E',
                onclick: function(e) {
                  xhr.accept(applicant.player.id)(ctrl);
                }
              }, 'Accept') : null)
            ])
          })))
      ),
      m('div.half.accepted',
        m('table.slist.user_list',
          m('thead', m('tr', m('th', {
            colspan: 3
          }, [
            m('strong', accepted.length),
            ' accepted players'
          ]))),
          m('tbody', accepted.map(function(applicant) {
            var variant = util.playerVariant(ctrl, applicant.player);
            return m('tr', {
              key: applicant.player.id,
              class: ctrl.userId === applicant.player.id ? 'me' : ''
            }, [
              m('td', util.player(applicant.player)),
              m('td.variant.text', {
                'data-icon': variant.icon
              }, variant.name),
              m('td.action', isHost ? m('a.button', {
                'data-icon': 'L',
                onclick: function(e) {
                  xhr.reject(applicant.player.id)(ctrl);
                }
              }) : null)
            ])
          })))
      )
    ),
    m('div.join_choice', ctrl.data.variants.map(function(variant) {
      return m('a.button', {
        'data-variant': variant.key
      }, variant.name);
    }))
  ];
};