[ARVADOS] updated: 437e25b167b3d1f7e4f8c32699de4243cfd59d85

git at public.curoverse.com git at public.curoverse.com
Mon Aug 11 12:24:07 EDT 2014


Summary of changes:
 apps/workbench/app/assets/javascripts/editable.js  |  6 +-
 .../app/controllers/application_controller.rb      | 10 ++-
 .../app/controllers/collections_controller.rb      |  1 +
 .../app/controllers/projects_controller.rb         | 41 +++++++++--
 .../workbench/app/controllers/search_controller.rb |  7 +-
 apps/workbench/app/helpers/application_helper.rb   |  4 +-
 apps/workbench/app/models/user.rb                  |  6 +-
 .../app/views/application/_choose.html.erb         |  4 +-
 .../app/views/application/_content.html.erb        | 21 ------
 .../views/application/_projects_tree_menu.html.erb |  9 +--
 .../app/views/collections/_choose_rows.html.erb    | 12 ++--
 apps/workbench/app/views/layouts/body.html.erb     | 21 ++++--
 .../app/views/projects/_index_projects.html.erb    |  8 ++-
 .../views/projects/_show_data_collections.html.erb | 32 +++++----
 apps/workbench/app/views/projects/index.html.erb   |  7 +-
 apps/workbench/config/initializers/redcloth.rb     | 22 ++++++
 .../test/integration/pipeline_instances_test.rb    |  1 +
 sdk/cli/bin/arv-run-pipeline-instance              | 33 ++++++---
 sdk/cli/bin/crunch-job                             | 29 ++++----
 sdk/python/arvados/commands/put.py                 | 38 +++++-----
 sdk/python/tests/test_arv_put.py                   | 81 +++++++++++++---------
 sdk/python/tests/test_keep_client.py               | 45 ++++++------
 .../arvados/v1/collections_controller.rb           |  6 +-
 .../controllers/arvados/v1/groups_controller.rb    | 17 ++++-
 .../arvados/v1/repositories_controller.rb          |  7 +-
 services/api/app/models/collection.rb              | 64 +++++++++--------
 services/api/app/models/locator.rb                 | 11 ++-
 services/api/app/models/user.rb                    |  6 +-
 services/api/config/application.default.yml        |  2 +-
 services/api/test/fixtures/authorized_keys.yml     | 16 +++++
 services/api/test/fixtures/collections.yml         | 12 ++++
 services/api/test/fixtures/links.yml               | 32 ++++++++-
 .../arvados/v1/groups_controller_test.rb           | 18 +++++
 .../arvados/v1/repositories_controller_test.rb     | 32 +++++++++
 .../functional/arvados/v1/users_controller_test.rb | 22 +++---
 services/api/test/unit/job_test.rb                 |  7 ++
 services/api/test/unit/user_test.rb                |  8 +--
 services/keep/src/keep/handler_test.go             |  9 +++
 services/keep/src/keep/handlers.go                 |  5 ++
 services/keep/src/keep/keep.go                     | 31 ++++++---
 40 files changed, 499 insertions(+), 244 deletions(-)
 create mode 100644 apps/workbench/config/initializers/redcloth.rb

       via  437e25b167b3d1f7e4f8c32699de4243cfd59d85 (commit)
       via  ff39794d11d503914bd67cbb6fed13bb38043fc2 (commit)
       via  a87bae216a271e7dfb629c27060fd3ec92965408 (commit)
       via  cedd2b046ddf4d2f819a4d1dedbbe82d4e70e72d (commit)
       via  02c368b2e6f6fd05930db1b57e5887b82a6c8b36 (commit)
       via  612d5fd9a0066665b522997f025499460d9edf43 (commit)
       via  381926c94a3b41d04101f68ec6a33e88fc795254 (commit)
       via  6d0b4ad4696fa11a3e940cb731f134a61fc26729 (commit)
       via  c6210b84588721c1e337c7dd9a0e25edb14301bb (commit)
       via  34f675d7e46d8446a11488d9970e589f988456bd (commit)
       via  af2a757d9be739543a912547eaefcadc851109e1 (commit)
       via  eef298a7cf58771583b255fb0e3e1cfcbcdb6e48 (commit)
       via  2945ea907a7c35da2d03d6775574fb1ad9be2b09 (commit)
       via  e932523a818a5d305ae541379b531a381f06edf4 (commit)
       via  d36a4308d2e3dd564ddee92347466833c57ccfc9 (commit)
       via  0850fa67a98dd28536312b1c4388b43eceba7b89 (commit)
       via  da85b5f1617656e03535dc490f027d7fae4d702e (commit)
       via  0cae143d67d3b45f2a945bd11d34da082a17b44c (commit)
       via  bda338bf2fd3bac648fad00e4646ff574510956f (commit)
       via  1076b57c3d701df3ceaa4d54973ccc533729f097 (commit)
       via  2d96a5bd256fc82dc274333ddaa4395016037170 (commit)
       via  b75aa879bc2035b5ac07ec3c389b4898194a03d7 (commit)
       via  299396a4e79e5e5f6e5519898f563cd19bac6431 (commit)
       via  b2800c21fc219f26066d531b2082dac0d377e7f4 (commit)
       via  a69da9e1aaa4e80209d21fba82e79d02b90222c0 (commit)
       via  4e5e843708a52e8587344be28269e14d7ad41409 (commit)
       via  21be87a976a7234e1a69e7f2a61c43c80e90b804 (commit)
       via  61e0cea2c42441dcdedd3776ca4520c8079eaa4b (commit)
       via  a15f61aef5f26dc6d0bb3e6ab02428b1d2a87ae8 (commit)
       via  5bbd6abc7a32c6912db5f36f0af5a923ac4b7c79 (commit)
       via  b1ea8228cf8b891a94deb09a619294315a0f1901 (commit)
       via  3c92c12e51c985e894851f90205aa02bb3895cdf (commit)
       via  7f15a960d533ae692112d90e79bfa1a69f4dd27f (commit)
       via  8e76d0a54757172747f93eaa797e6d1746f8cd32 (commit)
       via  780560ca57ad92e01edd23301750b8c1623d41db (commit)
       via  b20cc78fe133ad073edaa1f07effa90297015e99 (commit)
       via  e940b6f9ddaaabb5c21f1d0b10754231e74df67f (commit)
       via  5f24e9f419222574f16640448be2de731de584b8 (commit)
       via  7ab94b8875b1ada5021e5b494b3f38f7eab5328c (commit)
       via  22b165b48c33239aefee631ffbb00079c5486866 (commit)
      from  cd1c3d8ddae9b743fe557881005e08a63785e49e (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 437e25b167b3d1f7e4f8c32699de4243cfd59d85
Author: Phil Hodgson <bitbucket at philhodgson.net>
Date:   Mon Aug 11 12:23:44 2014 -0400

    Now recognizes Arvados links using Textile (refs #3522, refs #3354)
    The logic for detecting them relies on ApplicationHelper#link_to_if_arvados_object
    e.g.: "This is not an Arvados collection link but if the content hash were real then it would be":37dsfsad687986986+87

diff --git a/apps/workbench/app/controllers/application_controller.rb b/apps/workbench/app/controllers/application_controller.rb
index eb142ce..a673421 100644
--- a/apps/workbench/app/controllers/application_controller.rb
+++ b/apps/workbench/app/controllers/application_controller.rb
@@ -1,7 +1,6 @@
 class ApplicationController < ActionController::Base
   include ArvadosApiClientHelper
   include ApplicationHelper
-  include ActionView::Helpers::OutputSafetyHelper
 
   respond_to :html, :json, :js
   protect_from_forgery
@@ -178,7 +177,7 @@ class ApplicationController < ActionController::Base
       f.json do
         extra_attrs = { href: url_for(@object) }
         @object.textile_attributes.each do |textile_attr|
-          extra_attrs.merge!({ "#{textile_attr}Textile" => raw( RedCloth.new(@object.attributes[textile_attr].to_s).to_html ) })
+          extra_attrs.merge!({ "#{textile_attr}Textile" => view_context.render_content_from_database(@object.attributes[textile_attr]) })
         end
         render json: @object.attributes.merge(extra_attrs)
       end
diff --git a/apps/workbench/app/helpers/application_helper.rb b/apps/workbench/app/helpers/application_helper.rb
index b2bdbcf..102655c 100644
--- a/apps/workbench/app/helpers/application_helper.rb
+++ b/apps/workbench/app/helpers/application_helper.rb
@@ -12,7 +12,7 @@ module ApplicationHelper
   end
 
   def render_content_from_database(markup)
-    raw RedCloth.new(markup).to_html
+    raw RedCloth.new(markup.to_s).to_html(:refs_arvados, :textile) if markup
   end
 
   def human_readable_bytes_html(n)
@@ -160,7 +160,7 @@ module ApplicationHelper
 
     is_textile = object.textile_attributes.andand.include?(attr)
     attrvalue = attrvalue.to_json if attrvalue.is_a? Hash or attrvalue.is_a? Array
-    rendervalue = is_textile ? raw( RedCloth.new(attrvalue.to_s).to_html ) : attrvalue
+    rendervalue = is_textile ? render_content_from_database(attrvalue) : attrvalue
 
     ajax_options = {
       "data-pk" => {
diff --git a/apps/workbench/config/initializers/redcloth.rb b/apps/workbench/config/initializers/redcloth.rb
new file mode 100644
index 0000000..4c242de
--- /dev/null
+++ b/apps/workbench/config/initializers/redcloth.rb
@@ -0,0 +1,22 @@
+module RedClothArvadosLinkExtension
+
+  class RedClothViewBase < ActionView::Base
+    include ApplicationHelper
+    include ActionView::Helpers::UrlHelper
+    include Rails.application.routes.url_helpers
+
+    def helper_link_to_if_arvados_object(link, opts)
+      link_to_if_arvados_object(link, opts)
+    end
+  end
+
+  def refs_arvados(text)
+    text.gsub!(/"(?!\s)([^"]*\S)":(\S+)/) do
+      text, link = $~[1..2]
+      arvados_link = RedClothViewBase.new.helper_link_to_if_arvados_object(link, { :link_text => text })
+      arvados_link ? arvados_link : "#{text}:#{link}"
+    end
+  end
+end
+
+RedCloth.send(:include, RedClothArvadosLinkExtension)

commit ff39794d11d503914bd67cbb6fed13bb38043fc2
Author: Phil Hodgson <bitbucket at philhodgson.net>
Date:   Mon Aug 11 12:20:51 2014 -0400

    Bug fix since recent commits to master where Textile was not being rendered any more after an update (refs #2917, refs #3354)
    Something must have changed in the general JS event handling! Anyway, I now store the textile in a data attribute and then place it in the element later, during the on('hidden') phase

diff --git a/apps/workbench/app/assets/javascripts/editable.js b/apps/workbench/app/assets/javascripts/editable.js
index 25d38a9..dc54bda 100644
--- a/apps/workbench/app/assets/javascripts/editable.js
+++ b/apps/workbench/app/assets/javascripts/editable.js
@@ -58,7 +58,7 @@ $(document).
                     if ($(this).attr('data-name')) {
                         var textileAttr = $(this).attr('data-name') + 'Textile';
                         if (response[textileAttr]) {
-                            $(this).html(response[textileAttr]);
+                            $(this).attr('data-textile', response[textileAttr]);
                         }
                     }
                     return;
@@ -81,6 +81,10 @@ $(document).
                 // information if it appears elsewhere on the page.
                 if (reason != 'save') return;
                 var html = $(this).html();
+                if( $(this).attr('data-textile') ) {
+                    html = $(this).attr('data-textile');
+                    $(this).html(html);
+                }
                 var uuid = $(this).attr('data-object-uuid');
                 var attr = $(this).attr('data-name');
                 var edited = this;

commit a87bae216a271e7dfb629c27060fd3ec92965408
Merge: 02c368b cedd2b0
Author: Phil Hodgson <bitbucket at philhodgson.net>
Date:   Mon Aug 11 11:44:08 2014 -0400

    Merge branch 'master' into 3354-render-textile


commit 02c368b2e6f6fd05930db1b57e5887b82a6c8b36
Merge: cd1c3d8 381926c
Author: Phil Hodgson <bitbucket at philhodgson.net>
Date:   Mon Aug 11 07:22:45 2014 -0400

    Merge branch 'master' into 3354-render-textile


-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list