Example #1
0
  niceDateFormat: function(time) {
    var today = NiceTime._getTodayTime();

    if (time > today) {
      return Lang.get('nice-time.today');
    }

    if ((today - time) < 86400) {
      return Lang.get('nice-time.yesterday');
    }

    var date = new Date(time * 1000);

    var ret = date.getDate();
    ret += ' ';
    ret += Lang.get(
      'nice-time.date_' + NiceTime._month_map[date.getMonth()]
    );

    if ((today - time) > (86400 * 365)) {
      ret += ' ' + date.getFullYear();
    }

    return ret;
  },
Example #2
0
    ['shutter_speed','aperture','iso'].forEach(key => {
      if (!tags[key]) return;

      details.info.push(Lang.get(
        'gallery-photo.photo_' + key, {param: tags[key]}
      ));
    });
Example #3
0
      error: error => {
        Popups.createPopup({content: Lang.get('photolibrary.' + error)});

        this.setState({loading: false});
        this._requests.load_photos = null;
        delete this._requests.load_photos;
      },
Example #4
0
      error: error => {
        this._requests.tags = null;
        delete this._requests.tags;

        Popups.createPopup({
          content: Lang.get('page-editor.error_' + error)
        });
      },
Example #5
0
      error: error => {
        Popups.createPopup({content: Lang.get('photolibrary.' + error)});

        collection.loading = false;
        this.forceUpdate();

        this._requests[request_id] = null;
        delete this._requests[request_id];
      },
Example #6
0
  niceMonthFormat: function(time) {
    var today = NiceTime._getTodayTime();
    var date  = new Date(time * 1000);

    var ret = Lang.get(
      'nice-time.month_' + NiceTime._month_map[date.getMonth()]
    );
    
    return ret + ' ' + date.getFullYear();
  },
Example #7
0
      error: error => {
        this._requests.update = null;
        delete this._requests.update;

        this.setState({loading: false});

        Popups.createPopup({
          content: Lang.get('page-editor.error_' + error)
        });
      },
Example #8
0
          error: error => {
            Popups.createPopup({content: Lang.get('photolibrary.' + error)});

            photo.loading = false;

            this._requests[request] = null;
            delete this._requests[request];

            this.setState({
              photos: this.state.photos,
            });
          },
Example #9
0
          error: error => {
            photo.loading = false;

            this._requests[request] = null;
            delete this._requests[request];

            this.setState({
              photos:         this.state.photos,
              editor_loading: false,
              editor_error:   Lang.get('photolibrary.' + error),
            });
          },
Example #10
0
      success: collections => {

        collections.sort(function(a, b) {
          return parseInt(b.updated) - parseInt(a.updated);
        });

        collections.push({
          id:      -1,
          name:    Lang.get('photolibrary.collection_add'),
          updated: 0,
        });

        collections.push({
          id:      0,
          name:    Lang.get('photolibrary.photos_all'),
          updated: 0,
        });

        this.setState({collections});

        this._requests.load_collections = null;
        delete this._requests.load_collections;
      },
Example #11
0
  render() {
    this._lang = Lang.getLang();
    
    return (
      <div className="storage__uploader">

        <div
          ref="upload_box"
          onDrop={this._onDrop}
          onDragOver={this._onDragOver}
          onDragLeave={this._onDragLeave}
          onDragEnter={this._onDragEnter}
          className="storage__upload"
          onClick={this._toggleInput}
        >
          {Lang.get('storage.file_upload')}
        </div>

        <form ref="upload_form" encType="multipart/form-data">
          <input
            ref="upload_input"
            type="file"
            multiple="false"
            name="upload"
            onChange={this._inputOnChange}
          />
        </form>
      </div>
    );
  }
});
Example #12
0
      return true;
    }

    if (this._lang !== Lang.getLang()) {
      return true;
    }

    return false;
  },

  /**
   *  Convert downloads number to nice form
   */ 
  _niceDownloads(downloads) {
    if (downloads <= 0) {
      return Lang.get('storage.file_not_downloaded');
    }

    return Lang.get('storage.file_downloads', {
      downloads,
    });
  },

  /**
   *  Convert unixtimestamp number to nice form 
   */ 
  _niceUploadedTime(time) {
    return NiceTime.niceTimeFormat(time);
  },

  /**
Example #13
0
  shouldComponentUpdate(nextProps, nextState) {
    if (this._lang != Lang.getLang()) {
      return true;
    }

    if (this._url != window.location.pathname) {
      return true;
    }

    return false;
  },

  _getNavigation() {
    return [
      {
        name:  Lang.get('nav.photos'),
        match: /^\/(?:ru|en)\/admin\/photos\//,
        align: 'left',
        link:  '/' + Lang.getLang() + '/admin/photos/',
      },
      {
        name:  Lang.get('nav.blog'),
        match: /^\/(?:ru|en)\/admin\/pages\/blog\//,
        align: 'left',
        link:  '/' + Lang.getLang() + '/admin/pages/blog/',
      },
      {
        name:  Lang.get('nav.events'),
        match: /^\/(?:ru|en)\/admin\/pages\/events\//,
        align: 'left',
        link:  '/' + Lang.getLang() + '/admin/pages/events/',
Example #14
0
      error: error => {
        Popups.createPopup({content: Lang.get('photolibrary.' + error)});

        this._requests[request_id] = null;
        delete this._requests[request_id];
      },
Example #15
0
      error: error => {
        this._requests[key] = null;
        delete this._requests[key];
      },

      data: {
        id: this.state.id,
      }
    });
  },

  _makeTagsSelector() {
    return (
      <Tags
        tag="page"
        name={Lang.get('page-editor.page_tags')}
        value={this.state.page.tags}
        values={Object.keys(this.state.tags)}
        multiple={true}
        onSelect={this._updateTag}
      />
    );
  },

  render() {
    if (!this.state.page) {
      return (
        <Wrapper>
          <div className="loader" />
        </Wrapper>
      );
Example #16
0
    url = url.replace(/^\/(ru|en)\//, '/' + lang + '/');

    var className = 'site-footer__lang site-footer__lang--' + lang;

    return (
      <div>
        <div className="site-footer__placeholder" />

        <div className="site-footer__wrapper">
          <div className="site-footer">
            <div className={className}>
              <a href={url} onClick={e => {
                e.preventDefault();
                this._swapLang(lang, url);
              }}>
                {Lang.get('footer.swap_lang')}
              </a>
            </div>

            <div className="site-footer__copy">
              ferg.in &copy; 2013 – 2016
            </div>

            <div className="floating-clear"></div>
          </div>
        </div>
      </div>
    );
  },
});
Example #17
0
          onPhotoClick={this._selectPhoto}
        />
      );
    });

    if (photos.length) {
      photos.push(
        <div key="clear" className="photolibrary__photos-clear" />
      );
    }

    // photos placeholder
    if (!this.state.loading && !this.state.photos.length) {
      photos = (
        <div className="photolibrary__photos-not-found">
          {Lang.get('photolibrary.photos_not_found')}
        </div>
      );
    }

    // loader
    if (this.state.loading) {
      loader = (
        <div className="loader" />
      );
    }

    // paginator
    if (!this.state.loading) {
      paginator = (
        <Paginator
Example #18
0
      ++hidden_count;

      if (!this.state.expanded) {
        return;
      }
      
      collections.push(this._makeCollection(collection));
    });

    if (!this.state.expanded && hidden_count) {
      show_all = (
        <div
          className="photolibrary__collections-expand"
          onClick={this._expand}
        >
          {Lang.get('photolibrary.collections_expand')}
        </div>
      );
    }

    if (this.state.expanded) {
      hide_all = (
        <div
          className="photolibrary__collections-collapse"
          onClick={this._collapse}
        >
          {Lang.get('photolibrary.collections_collapse')}
        </div>
      );
    }
Example #19
0
    this.props.dispatch(makeApiRequest(
      PHOTO_API_KEY, '/api/gallery/getPhoto', {
        id,
        tag,
      }
    ));
  },

  /**
   *  Update page title
   */
  _updateTitle() {
    if (!this.props.photo || !this.props.photo.loaded || this.props.photo.error) {
      this.props.dispatch(setTitle(Lang.get(
        'gallery-photo.default_title'
      )));
    }

    else if (!this.props.photo.data.title) {
      this.props.dispatch(setTitle(Lang.get(
        'gallery-photo.default_title'
      )));
    }

    else {
      this.props.dispatch(setTitle(Lang.get(
        'gallery-photo.title',
        {photo: this.props.photo.data.title}
      )));
    }
Example #20
0
 // delete / restore buttons
 if (photo.loading) {
   loader = <div className="photolibrary__photo-loader loader-tiny"></div>;
 }
 else {
   if (photo.deleted) {
     restore = (
       <a
         className="photolibrary__photo-restore"
         onClick={(e) => {
           e.preventDefault();
           e.stopPropagation();
           this.props.onPhotoRestore(photo);
         }}
       >
         {Lang.get('photolibrary.photo_restore')}
       </a>
     );
   }
   else {
     remove = (
       <a
         className="photolibrary__photo-delete"
         onClick={(e) => {
           e.preventDefault();
           e.stopPropagation();
           this.props.onPhotoDelete(photo);
         }}
       >
         {Lang.get('photolibrary.photo_delete')}
       </a>
Example #21
0
        </div>
      );
    }

    // edit button
    if (parseInt(collection.id) > 0 && !collection.editing && !collection.loading) {
      edit = (
        <a
          className="photolibrary__collection-edit"
          onClick={(e) => {
            e.preventDefault();
            e.stopPropagation();
            this.props.onCollectionEdit(collection);
          }}
        >
          {Lang.get('photolibrary.collection_edit')}
        </a>
      );
    }

    // abort button
    if (collection.editing && !collection.loading) {
      abort = (
        <a
          className="photolibrary__collection-abort"
          onClick={e => {
            e.preventDefault();
            e.stopPropagation();
            this.props.onCollectionEditCancel(collection);
          }}
        >