[ARVADOS] updated: f3f96f2c0c57a7793428d168668f5b4cc130ab4f
git at public.curoverse.com
git at public.curoverse.com
Mon Feb 15 15:27:09 EST 2016
Summary of changes:
.../app/controllers/actions_controller.rb | 29 ++++++++++++++++++++++
.../app/controllers/application_controller.rb | 26 -------------------
.../app/views/application/_show_star.html.erb | 9 +++++++
apps/workbench/app/views/application/star.js.erb | 1 +
apps/workbench/app/views/projects/show.html.erb | 12 +--------
apps/workbench/config/routes.rb | 2 +-
.../crunchstat_summary/summarizer.py | 15 +++++------
7 files changed, 49 insertions(+), 45 deletions(-)
create mode 100644 apps/workbench/app/views/application/_show_star.html.erb
create mode 100644 apps/workbench/app/views/application/star.js.erb
via f3f96f2c0c57a7793428d168668f5b4cc130ab4f (commit)
via 9a2ad7a89ec86bb17d4c6a0767fdda087136b733 (commit)
via dafd66c2a336939739ee773b5dd3c65b69042fbb (commit)
via da3017f2d1c4a6838255814a96cbb66acde14d0a (commit)
via f831106444b3591b96fc204460092f85bbf7495d (commit)
from 4b3ada6aea3fe90aedfe610827eaf4e2c1442f03 (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 f3f96f2c0c57a7793428d168668f5b4cc130ab4f
Author: radhika <radhika at curoverse.com>
Date: Mon Feb 15 15:26:05 2016 -0500
8286: convert star method into action controller action and refresh the star icon in place rather than a full page refresh.
diff --git a/apps/workbench/app/controllers/actions_controller.rb b/apps/workbench/app/controllers/actions_controller.rb
index 58b8cdc..28680df 100644
--- a/apps/workbench/app/controllers/actions_controller.rb
+++ b/apps/workbench/app/controllers/actions_controller.rb
@@ -238,6 +238,35 @@ You can try recreating the collection to get a copy with full provenance data."
end
end
+ # star / unstar the current project
+ def star
+ links = Link.where(tail_uuid: current_user.uuid,
+ head_uuid: @object.uuid,
+ link_class: 'star')
+
+ if params['status'] == 'create'
+ # create 'star' link if one does not already exist
+ if !links.andand.any?
+ dst = Link.new(owner_uuid: current_user.uuid,
+ tail_uuid: current_user.uuid,
+ head_uuid: @object.uuid,
+ link_class: 'star',
+ name: @object.uuid)
+ dst.save!
+ end
+ else # delete any existing 'star' links
+ if links.andand.any?
+ links.each do |link|
+ link.destroy
+ end
+ end
+ end
+
+ respond_to do |format|
+ format.js
+ end
+ end
+
protected
def derive_unique_filename filename, manifest_files
diff --git a/apps/workbench/app/controllers/application_controller.rb b/apps/workbench/app/controllers/application_controller.rb
index 5094556..1fc1580 100644
--- a/apps/workbench/app/controllers/application_controller.rb
+++ b/apps/workbench/app/controllers/application_controller.rb
@@ -446,32 +446,6 @@ class ApplicationController < ActionController::Base
end
end
- def star
- links = Link.where(tail_uuid: current_user.uuid,
- head_uuid: @object.uuid,
- link_class: 'star')
-
- if params['status'] == 'create'
- # create 'star' link if one does not already exist
- if !links.andand.any?
- dst = Link.new(owner_uuid: current_user.uuid,
- tail_uuid: current_user.uuid,
- head_uuid: @object.uuid,
- link_class: 'star',
- name: @object.uuid)
- dst.save!
- end
- else # delete any existing 'star' links
- if links.andand.any?
- links.each do |link|
- link.destroy
- end
- end
- end
-
- show
- end
-
helper_method :is_starred
def is_starred
links = Link.where(tail_uuid: current_user.uuid,
diff --git a/apps/workbench/app/views/application/_show_star.html.erb b/apps/workbench/app/views/application/_show_star.html.erb
new file mode 100644
index 0000000..50775f1
--- /dev/null
+++ b/apps/workbench/app/views/application/_show_star.html.erb
@@ -0,0 +1,9 @@
+<% if is_starred %>
+ <%= link_to(star_path(status: 'delete', id:@object.uuid, action_method: 'get'), class: "btn btn-xs star-unstar", title: "Remove from list of favorites", remote: true) do %>
+ <i class="fa fa-fw fa-star"></i>
+ <% end %>
+<% else %>
+ <%= link_to(star_path(status: 'create', id:@object.uuid, action_method: 'get'), class: "btn btn-xs star-unstar", title: "Add to list of favorites", remote: true) do %>
+ <i class="fa fa-fw fa-star-o"></i>
+ <% end %>
+<% end %>
diff --git a/apps/workbench/app/views/application/star.js.erb b/apps/workbench/app/views/application/star.js.erb
new file mode 100644
index 0000000..e472ab0
--- /dev/null
+++ b/apps/workbench/app/views/application/star.js.erb
@@ -0,0 +1 @@
+$(".star-unstar").html("<%= escape_javascript(render partial: 'show_star') %>");
diff --git a/apps/workbench/app/views/projects/show.html.erb b/apps/workbench/app/views/projects/show.html.erb
index 0f9df76..6033a34 100644
--- a/apps/workbench/app/views/projects/show.html.erb
+++ b/apps/workbench/app/views/projects/show.html.erb
@@ -3,17 +3,7 @@
<% if @object.uuid == current_user.andand.uuid %>
Home
<% else %>
- <% starred = false %>
- <% starred = true if is_starred %>
- <% if starred %>
- <%= link_to(url_for({action: 'star', status: 'delete', id: @object.uuid, controller: 'projects'}), method: :post, class: "btn btn-xs", title: "Remove from list of favorites") do %>
- <i class="fa fa-fw fa-star"></i>
- <% end %>
- <% else %>
- <%= link_to(url_for({action: 'star', status: 'create', id: @object.uuid, controller: 'projects'}), method: :post, class: "btn btn-xs", title: "Add to list of favorites") do %>
- <i class="fa fa-fw fa-star-o"></i>
- <% end %>
- <% end %>
+ <%= render partial: "show_star" %>
<%= render_editable_attribute @object, 'name', nil, { 'data-emptytext' => "New project" } %>
<% end %>
</h2>
diff --git a/apps/workbench/config/routes.rb b/apps/workbench/config/routes.rb
index b1119e7..fc72ea2 100644
--- a/apps/workbench/config/routes.rb
+++ b/apps/workbench/config/routes.rb
@@ -12,6 +12,7 @@ ArvadosWorkbench::Application.routes.draw do
get "users/setup" => 'users#setup', :as => :setup_user
get "report_issue_popup" => 'actions#report_issue_popup', :as => :report_issue_popup
post "report_issue" => 'actions#report_issue', :as => :report_issue
+ get "star" => 'actions#star', :as => :star
resources :nodes
resources :humans
resources :traits
@@ -89,7 +90,6 @@ ArvadosWorkbench::Application.routes.draw do
post 'share_with', on: :member
get 'tab_counts', on: :member
get 'public', on: :collection
- post 'star', on: :member
end
resources :search do
commit 9a2ad7a89ec86bb17d4c6a0767fdda087136b733
Merge: 4b3ada6 dafd66c
Author: radhika <radhika at curoverse.com>
Date: Mon Feb 15 13:50:48 2016 -0500
Merge branch 'master' into 8286-fav-projects
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list