Bladeren bron

[search] Adding fromnow function in editor

Romain Rigaux 12 jaren geleden
bovenliggende
commit
8620f3e56e

+ 1 - 0
apps/search/src/search/templates/admin_collection_template.mako

@@ -180,6 +180,7 @@ ${ commonheader(_('Search'), "search", user, "40px") | n,unicode }
                   <option title="${ _('Formats a date in the DD-MM-YYYY HH:mm:ss format') }" value="{{#datetime}} {{/datetime}}">{{#datetime}}</option>
                   <option title="${ _('Formats a date in the DD-MM-YYYY HH:mm:ss format') }" value="{{#datetime}} {{/datetime}}">{{#datetime}}</option>
                   <option title="${ _('Formats a date in the full format') }" value="{{#fulldate}} {{/fulldate}}">{{#fulldate}}</option>
                   <option title="${ _('Formats a date in the full format') }" value="{{#fulldate}} {{/fulldate}}">{{#fulldate}}</option>
                   <option title="${ _('Formats a date as a Unix timestamp') }" value="{{#timestamp}} {{/timestamp}}">{{#timestamp}}</option>
                   <option title="${ _('Formats a date as a Unix timestamp') }" value="{{#timestamp}} {{/timestamp}}">{{#timestamp}}</option>
+                  <option title="${ _('Formats a Unix timestamp as Ns, Nmin, Ndays... ago') }" value="{{#fromnow}} {{/fromnow}}">{{#fromnow}}</option>
                   <option title="${ _('Downloads and embed the file in the browser') }" value="{{#embeddeddownload}} {{/embeddeddownload}}">{{#embeddeddownload}}</option>
                   <option title="${ _('Downloads and embed the file in the browser') }" value="{{#embeddeddownload}} {{/embeddeddownload}}">{{#embeddeddownload}}</option>
                   <option title="${ _('Downloads the linked file') }" value="{{#download}} {{/download}}">{{#download}}</option>
                   <option title="${ _('Downloads the linked file') }" value="{{#download}} {{/download}}">{{#download}}</option>
                   <option title="${ _('Preview file in File Browser') }" value="{{#preview}} {{/preview}}">{{#preview}}</option>
                   <option title="${ _('Preview file in File Browser') }" value="{{#preview}} {{/preview}}">{{#preview}}</option>

+ 10 - 10
apps/search/src/search/templates/search.mako

@@ -32,7 +32,7 @@ ${ commonheader(_('Search'), "search", user, "40px") | n,unicode }
   % if user.is_superuser:
   % if user.is_superuser:
     <div class="pull-right" style="margin-top: 4px">
     <div class="pull-right" style="margin-top: 4px">
       <a class="change-settings" href="#"><i class="icon-edit"></i> ${ _('Customize this collection') }</a> &nbsp;&nbsp;
       <a class="change-settings" href="#"><i class="icon-edit"></i> ${ _('Customize this collection') }</a> &nbsp;&nbsp;
-      <a href="${ url('search:admin_collections') }"><i class="icon-edit"></i> ${ _('Collection manager') }</a>
+      <a href="${ url('search:admin_collections') }"><i class="icon-sitemap"></i> ${ _('Collection manager') }</a>
     </div>
     </div>
   % endif
   % endif
   <form class="form-search" style="margin: 0">
   <form class="form-search" style="margin: 0">
@@ -246,21 +246,21 @@ ${ commonheader(_('Search'), "search", user, "40px") | n,unicode }
     % endif
     % endif
 
 
     % if user.is_superuser:
     % if user.is_superuser:
-        $(".dropdown-collection").each(function () {
-          if ($(this).data("value") == $("select[name='collection']").val()) {
-            $(".change-settings").attr("href", $(this).data("settings-url"));
-          }
-        });
+      $(".dropdown-collection").each(function () {
+        if ($(this).data("value") == $("select[name='collection']").val()) {
+          $(".change-settings").attr("href", $(this).data("settings-url"));
+        }
+      });
     % endif
     % endif
 
 
     $(".dropdown-collection").click(function (e) {
     $(".dropdown-collection").click(function (e) {
       e.preventDefault();
       e.preventDefault();
-      var solrName = $(this).data("value");
-      $("select[name='collection']").val(solrName);
+      var collectionId = $(this).data("value");
+      $("select[name='collection']").val(collectionId);
       % if user.is_superuser:
       % if user.is_superuser:
-          $(".change-settings").attr("href", $(this).data("settings-url"));
+        $(".change-settings").attr("href", $(this).data("settings-url"));
       % endif
       % endif
-      $.cookie("hueSearchLastCollection", solrName, {expires: 90});
+      $.cookie("hueSearchLastCollection", collectionId, {expires: 90});
       $("form").submit();
       $("form").submit();
     });
     });