sufia 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +12 -1
- data/History.md +10 -0
- data/README.md +1 -6
- data/app/assets/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/app/assets/javascripts/sufia.js +3 -4
- data/app/assets/javascripts/sufia/batch_select_all.js +2 -2
- data/app/controllers/concerns/sufia/users_controller_behavior.rb +133 -0
- data/app/controllers/users_controller.rb +1 -115
- data/app/helpers/trophy_helper.rb +2 -3
- data/app/models/datastreams/properties_datastream.rb +5 -3
- data/app/views/batch/edit.html.erb +7 -3
- data/app/views/batch_edits/edit.html.erb +47 -77
- data/app/views/dashboard/_index_partials/_list_files.html.erb +25 -12
- data/app/views/dashboard/index.html.erb +29 -44
- data/app/views/generic_files/_descriptions.html.erb +17 -17
- data/app/views/generic_files/_permission.html.erb +7 -124
- data/app/views/generic_files/_permission_form.html.erb +123 -0
- data/app/views/generic_files/_versioning.html.erb +1 -1
- data/app/views/generic_files/edit.html.erb +9 -21
- data/app/views/users/_notify_number.html.erb +1 -1
- data/app/views/users/edit.html.erb +1 -1
- data/config/routes.rb +3 -1
- data/lib/sufia.rb +5 -1
- data/lib/sufia/files_controller_behavior.rb +8 -8
- data/lib/sufia/user.rb +4 -8
- data/lib/sufia/version.rb +1 -1
- data/spec/controllers/generic_files_controller_spec.rb +8 -0
- data/spec/controllers/users_controller_spec.rb +22 -0
- data/spec/models/properties_datastream_spec.rb +21 -0
- data/spec/routing/route_spec.rb +1 -0
- data/sufia.gemspec +0 -1
- data/vendor/assets/javascripts/ZeroClipboard.min.js +8 -0
- data/vendor/assets/javascripts/ZeroClipboard.swf +0 -0
- metadata +8 -19
- data/app/assets/javascripts/sufia/tabs.js +0 -58
- data/app/views/catalog/_uva_tabs.html.erb +0 -10
- data/vendor/assets/javascripts/jquery.zclip.min.js +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc608966c9285b346242ba6be80305cc3ee82cad
|
4
|
+
data.tar.gz: 7be4d8597798945013fdf1c4b6b82dbf267ab041
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7aa180c10138cd6460044b1271de080662daab0bc355c10e4e64177fc16ec6c3683191733ae2244836feb31ed1b4821cbfa12dfe2183a22fb7a7c55b260618bb
|
7
|
+
data.tar.gz: 7bc1d454033cc0b2cd9eee243e30d91ddc890bd6745136b966b4025c272d85d34a2a8d88b32b47ff83c8fceb2264462ac5d24e65ad1c95a0699b1739c69d918b
|
data/.travis.yml
CHANGED
@@ -3,4 +3,15 @@ rvm:
|
|
3
3
|
- "1.9.3"
|
4
4
|
- "2.0.0"
|
5
5
|
notifications:
|
6
|
-
|
6
|
+
email:
|
7
|
+
recipients:
|
8
|
+
- "ul-dlt-applications@lists.psu.edu"
|
9
|
+
- "michael@psu.edu"
|
10
|
+
on_success: "change"
|
11
|
+
on_failure: "always"
|
12
|
+
irc:
|
13
|
+
channels:
|
14
|
+
- "irc.freenode.org#scholarsphere"
|
15
|
+
- "irc.freenode.org#projecthydra"
|
16
|
+
template:
|
17
|
+
- "%{repository}//%{branch}@%{commit} by %{author}: %{message} - %{build_url}"
|
data/History.md
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
# History of Sufia releases
|
2
2
|
|
3
|
+
## 1.1.0
|
4
|
+
* Allows a user to deposit on behalf of another user
|
5
|
+
* Tweaks dashboard UI to be less busy: actions now in dropdown button
|
6
|
+
* Allows HTML tags in metadata helps to render
|
7
|
+
* Fixes notifications icon
|
8
|
+
* Raises routing errors in dev and test so they can be resolved
|
9
|
+
* Refactors users controller for easy re-use
|
10
|
+
* Adds JSON support to users controller
|
11
|
+
* Removes dependency on sitemap gem
|
12
|
+
|
3
13
|
## 1.0.0
|
4
14
|
* Initial API-stable release
|
5
15
|
|
data/README.md
CHANGED
@@ -1,9 +1,4 @@
|
|
1
|
-
# Sufia
|
2
|
-
|
3
|
-
## Code Status
|
4
|
-
|
5
|
-
[![Build Status](https://travis-ci.org/curationexperts/sufia.png?branch=master)](https://travis-ci.org/curationexperts/sufia)
|
6
|
-
[![Dependencies Status](https://gemnasium.com/curationexperts/sufia.png)](https://gemnasium.com/curationexperts/sufia)
|
1
|
+
# Sufia [![Version](https://badge.fury.io/rb/sufia.png)](http://badge.fury.io/rb/sufia) [![Build Status](https://travis-ci.org/projecthydra/sufia.png?branch=master)](https://travis-ci.org/projecthydra/sufia) [![Dependency Status](https://gemnasium.com/projecthydra/sufia.png)](https://gemnasium.com/projecthydra/sufia)
|
7
2
|
|
8
3
|
## What is Sufia?
|
9
4
|
Sufia is a component that adds self-deposit institutional repository features to a Rails app.
|
Binary file
|
@@ -28,18 +28,18 @@ limitations under the License.
|
|
28
28
|
//= require bootstrap-collapse
|
29
29
|
//= require bootstrap-tooltip
|
30
30
|
//= require bootstrap-popover
|
31
|
+
//= require bootstrap-tab
|
31
32
|
|
32
33
|
//= require video
|
33
34
|
//= require audio.min
|
34
35
|
//= require jquery.validate
|
35
36
|
//= require swfobject
|
36
|
-
//= require
|
37
|
+
//= require ZeroClipboard.min
|
37
38
|
|
38
39
|
//= require batch_edit
|
39
40
|
//= require terms_of_service
|
40
41
|
//= require fileupload
|
41
42
|
//= require sufia/permissions
|
42
|
-
//= require sufia/tabs
|
43
43
|
//= require sufia/trophy
|
44
44
|
//= require sufia/batch_select_all
|
45
45
|
//= require sufia/multiForm
|
@@ -65,7 +65,7 @@ function notify_update_link() {
|
|
65
65
|
// short hand for $(document).ready();
|
66
66
|
$(function() {
|
67
67
|
|
68
|
-
// set up global batch edit options to override the ones in the gem
|
68
|
+
// set up global batch edit options to override the ones in the gem
|
69
69
|
window.batch_edits_options = { checked_label: "",unchecked_label: "",progress_label: "",status_label: "",css_class: "batch_toggle"};
|
70
70
|
|
71
71
|
setInterval(notify_update_link, 30*1000);
|
@@ -194,4 +194,3 @@ function initialize_audio() {
|
|
194
194
|
});
|
195
195
|
};
|
196
196
|
}
|
197
|
-
|
@@ -5,10 +5,10 @@
|
|
5
5
|
var n = $(".batch_toggle:checked").length;
|
6
6
|
if ((n>0) || (forceOn)) {
|
7
7
|
$('.batch-select-all').show();
|
8
|
-
$('
|
8
|
+
$('#batch-edit').show();
|
9
9
|
} else if ( otherPage){
|
10
10
|
$('.batch-select-all').hide();
|
11
|
-
$('
|
11
|
+
$('#batch-edit').hide();
|
12
12
|
}
|
13
13
|
$("body").css("cursor", "auto");
|
14
14
|
}
|
@@ -0,0 +1,133 @@
|
|
1
|
+
module Sufia::UsersControllerBehavior
|
2
|
+
extend ActiveSupport::Concern
|
3
|
+
|
4
|
+
included do
|
5
|
+
prepend_before_filter :find_user, :except => [:index, :search, :notifications_number]
|
6
|
+
before_filter :authenticate_user!, only: [:edit, :update, :follow, :unfollow, :toggle_trophy]
|
7
|
+
before_filter :user_is_current_user, only: [:edit, :update, :toggle_trophy]
|
8
|
+
|
9
|
+
before_filter :user_not_current_user, only: [:follow, :unfollow]
|
10
|
+
end
|
11
|
+
|
12
|
+
def index
|
13
|
+
sort_val = get_sort
|
14
|
+
query = params[:uq].blank? ? nil : "%"+params[:uq].downcase+"%"
|
15
|
+
base = User.where(*base_query)
|
16
|
+
unless query.blank?
|
17
|
+
base = base.where("#{Devise.authentication_keys.first} like lower(?) OR display_name like lower(?)", query, query)
|
18
|
+
end
|
19
|
+
@users = base.order(sort_val).page(params[:page]).per(10)
|
20
|
+
|
21
|
+
respond_to do |format|
|
22
|
+
format.html
|
23
|
+
format.json { render json: @users.to_json }
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
# Display user profile
|
29
|
+
def show
|
30
|
+
if @user.respond_to? :profile_events
|
31
|
+
@events = @user.profile_events(100)
|
32
|
+
else
|
33
|
+
@events = []
|
34
|
+
end
|
35
|
+
@trophies = @user.trophy_ids
|
36
|
+
@followers = @user.followers
|
37
|
+
@following = @user.all_following
|
38
|
+
end
|
39
|
+
|
40
|
+
# Display form for users to edit their profile information
|
41
|
+
def edit
|
42
|
+
@user = current_user
|
43
|
+
@trophies = @user.trophy_ids
|
44
|
+
end
|
45
|
+
|
46
|
+
# Process changes from profile form
|
47
|
+
def update
|
48
|
+
@user.update_attributes(params[:user])
|
49
|
+
@user.populate_attributes if params[:update_directory]
|
50
|
+
@user.avatar = nil if params[:delete_avatar]
|
51
|
+
unless @user.save
|
52
|
+
redirect_to sufia.edit_profile_path(URI.escape(@user.to_s,'@.')), alert: @user.errors.full_messages
|
53
|
+
return
|
54
|
+
end
|
55
|
+
delete_trophy = params.keys.reject{|k,v|k.slice(0,'remove_trophy'.length)!='remove_trophy'}
|
56
|
+
delete_trophy = delete_trophy.map{|v| v.slice('remove_trophy_'.length..-1)}
|
57
|
+
delete_trophy.each do | smash_trophy |
|
58
|
+
Trophy.where(user_id: current_user.id, generic_file_id: smash_trophy.slice("#{Sufia::Engine.config.id_namespace}:".length..-1)).each.map(&:delete)
|
59
|
+
end
|
60
|
+
Sufia.queue.push(UserEditProfileEventJob.new(@user.user_key))
|
61
|
+
redirect_to sufia.profile_path(URI.escape(@user.to_s,'@.')), notice: "Your profile has been updated"
|
62
|
+
end
|
63
|
+
|
64
|
+
def toggle_trophy
|
65
|
+
id = params[:file_id]
|
66
|
+
id = "#{Sufia::Engine.config.id_namespace}:#{id}" unless id.include?(":")
|
67
|
+
unless current_user.can? :edit, id
|
68
|
+
redirect_to root_path, alert: "You do not have permissions to the file"
|
69
|
+
return false
|
70
|
+
end
|
71
|
+
# TODO make sure current user has access to file
|
72
|
+
t = Trophy.where(:generic_file_id => params[:file_id], :user_id => current_user.id).first
|
73
|
+
if t.blank?
|
74
|
+
t = Trophy.create(:generic_file_id => params[:file_id], :user_id => current_user.id)
|
75
|
+
return false unless t.persisted?
|
76
|
+
else
|
77
|
+
t.delete
|
78
|
+
#TODO do this better says Mike
|
79
|
+
return false if t.persisted?
|
80
|
+
end
|
81
|
+
render :json => t
|
82
|
+
end
|
83
|
+
|
84
|
+
|
85
|
+
# Follow a user
|
86
|
+
def follow
|
87
|
+
unless current_user.following?(@user)
|
88
|
+
current_user.follow(@user)
|
89
|
+
Sufia.queue.push(UserFollowEventJob.new(current_user.user_key, @user.user_key))
|
90
|
+
end
|
91
|
+
redirect_to sufia.profile_path(URI.escape(@user.to_s,'@.')), notice: "You are following #{@user.to_s}"
|
92
|
+
end
|
93
|
+
|
94
|
+
# Unfollow a user
|
95
|
+
def unfollow
|
96
|
+
if current_user.following?(@user)
|
97
|
+
current_user.stop_following(@user)
|
98
|
+
Sufia.queue.push(UserUnfollowEventJob.new(current_user.user_key, @user.user_key))
|
99
|
+
end
|
100
|
+
redirect_to sufia.profile_path(URI.escape(@user.to_s,'@.')), notice: "You are no longer following #{@user.to_s}"
|
101
|
+
end
|
102
|
+
|
103
|
+
protected
|
104
|
+
|
105
|
+
# You can override base_query to return a list of arguments
|
106
|
+
def base_query
|
107
|
+
[nil]
|
108
|
+
end
|
109
|
+
|
110
|
+
def find_user
|
111
|
+
@user = User.from_url_component(params[:uid])
|
112
|
+
redirect_to root_path, alert: "User '#{params[:uid]}' does not exist" if @user.nil?
|
113
|
+
end
|
114
|
+
|
115
|
+
def user_is_current_user
|
116
|
+
redirect_to sufia.profile_path(URI.escape(@user.to_s,'@.')), alert: "Permission denied: cannot access this page." unless @user == current_user
|
117
|
+
end
|
118
|
+
|
119
|
+
def user_not_current_user
|
120
|
+
redirect_to sufia.profile_path(URI.escape(@user.to_s,'@.')), alert: "You cannot follow or unfollow yourself" if @user == current_user
|
121
|
+
end
|
122
|
+
|
123
|
+
def get_sort
|
124
|
+
sort = params[:sort].blank? ? "name" : params[:sort]
|
125
|
+
sort_val = case sort
|
126
|
+
when "name" then "display_name"
|
127
|
+
when "name desc" then "display_name DESC"
|
128
|
+
else sort
|
129
|
+
end
|
130
|
+
return sort_val
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
@@ -13,119 +13,5 @@
|
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
15
|
class UsersController < ApplicationController
|
16
|
-
|
17
|
-
before_filter :authenticate_user!, only: [:edit, :update, :follow, :unfollow, :toggle_trophy]
|
18
|
-
before_filter :user_is_current_user, only: [:edit, :update, :toggle_trophy]
|
19
|
-
|
20
|
-
before_filter :user_not_current_user, only: [:follow, :unfollow]
|
21
|
-
|
22
|
-
def index
|
23
|
-
sort_val = get_sort
|
24
|
-
query = params[:uq].blank? ? nil : "%"+params[:uq].downcase+"%"
|
25
|
-
if query.blank?
|
26
|
-
@users = User.order(sort_val).page(params[:page]).per(10) if query.blank?
|
27
|
-
else
|
28
|
-
@users = User.where("(login like lower(?) OR display_name like lower(?))",query,query).order(sort_val).page(params[:page]).per(10)
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
# Display user profile
|
33
|
-
def show
|
34
|
-
if @user.respond_to? :profile_events
|
35
|
-
@events = @user.profile_events(100)
|
36
|
-
else
|
37
|
-
@events = []
|
38
|
-
end
|
39
|
-
@trophies = @user.trophy_ids
|
40
|
-
@followers = @user.followers
|
41
|
-
@following = @user.all_following
|
42
|
-
end
|
43
|
-
|
44
|
-
# Display form for users to edit their profile information
|
45
|
-
def edit
|
46
|
-
@user = current_user
|
47
|
-
@trophies = @user.trophy_ids
|
48
|
-
end
|
49
|
-
|
50
|
-
# Process changes from profile form
|
51
|
-
def update
|
52
|
-
@user.update_attributes(params[:user])
|
53
|
-
|
54
|
-
@user.populate_attributes if params[:update_directory]
|
55
|
-
@user.avatar = nil if params[:delete_avatar]
|
56
|
-
unless @user.save
|
57
|
-
redirect_to sufia.edit_profile_path(URI.escape(@user.to_s,'@.')), alert: @user.errors.full_messages
|
58
|
-
return
|
59
|
-
end
|
60
|
-
Sufia.queue.push(UserEditProfileEventJob.new(@user.user_key))
|
61
|
-
redirect_to sufia.profile_path(URI.escape(@user.to_s,'@.')), notice: "Your profile has been updated"
|
62
|
-
delete_trophy = params.keys.reject{|k,v|k.slice(0,'remove_trophy'.length)!='remove_trophy'}
|
63
|
-
delete_trophy = delete_trophy.map{|v| v.slice('remove_trophy_'.length..-1)}
|
64
|
-
delete_trophy.each do | smash_trophy |
|
65
|
-
Trophy.where(user_id: current_user.id, generic_file_id: smash_trophy.slice("#{Sufia::Engine.config.id_namespace}:".length..-1)).each.map(&:delete)
|
66
|
-
#Trophy.where(user_id: current_user.id, generic_file_id: smash_trophy.slice("#{Sufia::Engine.config.id_namespace}:".length..-1)).each.map(&:delete)
|
67
|
-
end
|
68
|
-
end
|
69
|
-
def toggle_trophy
|
70
|
-
id = params[:file_id]
|
71
|
-
id = "#{Sufia::Engine.config.id_namespace}:#{id}" unless id.include?(":")
|
72
|
-
unless current_user.can? :edit, id
|
73
|
-
redirect_to root_path, alert: "You do not have permissions to the file"
|
74
|
-
return false
|
75
|
-
end
|
76
|
-
# TO DO make sure current user has access to file
|
77
|
-
t = Trophy.where(:generic_file_id => params[:file_id], :user_id => current_user.id).first
|
78
|
-
if t.blank?
|
79
|
-
t = Trophy.create(:generic_file_id => params[:file_id], :user_id => current_user.id)
|
80
|
-
return false unless t.persisted?
|
81
|
-
else
|
82
|
-
t.delete
|
83
|
-
#TODO do this better says Mike
|
84
|
-
return false if t.persisted?
|
85
|
-
end
|
86
|
-
render :json => t
|
87
|
-
end
|
88
|
-
|
89
|
-
|
90
|
-
# Follow a user
|
91
|
-
def follow
|
92
|
-
unless current_user.following?(@user)
|
93
|
-
current_user.follow(@user)
|
94
|
-
Sufia.queue.push(UserFollowEventJob.new(current_user.user_key, @user.user_key))
|
95
|
-
end
|
96
|
-
redirect_to sufia.profile_path(URI.escape(@user.to_s,'@.')), notice: "You are following #{@user.to_s}"
|
97
|
-
end
|
98
|
-
|
99
|
-
# Unfollow a user
|
100
|
-
def unfollow
|
101
|
-
if current_user.following?(@user)
|
102
|
-
current_user.stop_following(@user)
|
103
|
-
Sufia.queue.push(UserUnfollowEventJob.new(current_user.user_key, @user.user_key))
|
104
|
-
end
|
105
|
-
redirect_to sufia.profile_path(URI.escape(@user.to_s,'@.')), notice: "You are no longer following #{@user.to_s}"
|
106
|
-
end
|
107
|
-
|
108
|
-
private
|
109
|
-
def find_user
|
110
|
-
@user = User.from_url_component(params[:uid])
|
111
|
-
redirect_to root_path, alert: "User '#{params[:uid]}' does not exist" if @user.nil?
|
112
|
-
end
|
113
|
-
|
114
|
-
def user_is_current_user
|
115
|
-
redirect_to sufia.profile_path(URI.escape(@user.to_s,'@.')), alert: "Permission denied: cannot access this page." unless @user == current_user
|
116
|
-
end
|
117
|
-
|
118
|
-
def user_not_current_user
|
119
|
-
redirect_to sufia.profile_path(URI.escape(@user.to_s,'@.')), alert: "You cannot follow or unfollow yourself" if @user == current_user
|
120
|
-
end
|
121
|
-
|
122
|
-
def get_sort
|
123
|
-
sort = params[:sort].blank? ? "name" : params[:sort]
|
124
|
-
sort_val = case sort
|
125
|
-
when "name" then "display_name"
|
126
|
-
when "name desc" then "display_name DESC"
|
127
|
-
else sort
|
128
|
-
end
|
129
|
-
return sort_val
|
130
|
-
end
|
16
|
+
include Sufia::UsersControllerBehavior
|
131
17
|
end
|
@@ -16,12 +16,11 @@
|
|
16
16
|
module TrophyHelper
|
17
17
|
def display_trophy_link(user, noid)
|
18
18
|
trophyclass = "trophy-off"
|
19
|
-
trophytitle= "Highlight
|
19
|
+
trophytitle= "Highlight File on Profile"
|
20
20
|
if user.trophies.map(&:generic_file_id).include? noid
|
21
21
|
trophyclass = "trophy-on"
|
22
|
-
trophytitle= "Unhighlight work"
|
23
22
|
end
|
24
23
|
|
25
|
-
return link_to raw("<i class='#{trophyclass} icon-trophy
|
24
|
+
return link_to raw("<i class='#{trophyclass} icon-trophy'></i> #{trophytitle}"),"", :class=> 'trophy-class', :title => trophytitle, :id => noid, :remote=>true # link to trophy
|
26
25
|
end
|
27
26
|
end
|
@@ -15,11 +15,13 @@
|
|
15
15
|
# properties datastream: catch-all for info that didn't have another home. Particularly depositor.
|
16
16
|
class PropertiesDatastream < ActiveFedora::OmDatastream
|
17
17
|
set_terminology do |t|
|
18
|
-
t.root(:path=>"fields"
|
18
|
+
t.root(:path=>"fields" )
|
19
19
|
# This is where we put the user id of the object depositor -- impacts permissions/access controls
|
20
|
-
t.depositor :
|
20
|
+
t.depositor :index_as=>[:stored_searchable]
|
21
21
|
# This is where we put the relative path of the file if submitted as a folder
|
22
|
-
t.relative_path
|
22
|
+
t.relative_path
|
23
|
+
|
24
|
+
t.proxy_depositor path: 'proxyDepositor', :index_as=>:symbol
|
23
25
|
end
|
24
26
|
|
25
27
|
def self.xml_template
|
@@ -23,7 +23,7 @@ limitations under the License.
|
|
23
23
|
$('#permissions_display').show();
|
24
24
|
|
25
25
|
// initialize popover helpers
|
26
|
-
$("a[rel=popover]").popover();
|
26
|
+
$("a[rel=popover]").popover({ html: true });
|
27
27
|
|
28
28
|
confirmation_needed = true;
|
29
29
|
window.onbeforeunload = confirmExit;
|
@@ -45,8 +45,12 @@ function confirmExit(){
|
|
45
45
|
</div>
|
46
46
|
<%= form_for([@batch, @generic_file], :url => sufia.batch_generic_files_path, :html => {:multipart => true, :class => 'form-horizontal'}) do |f| %>
|
47
47
|
|
48
|
-
<%= render :partial => 'metadata', :formats => [:html], :locals => {:f => f} %>
|
48
|
+
<%= render :partial => 'metadata', :formats => [:html], :locals => {:f => f} %>
|
49
49
|
|
50
|
-
<%= render :partial => 'generic_files/
|
50
|
+
<%= render :partial => 'generic_files/permission_form', :formats => [:html], :locals => { :gf => @generic_file, :batch=> @batch } %>
|
51
|
+
|
52
|
+
<div class="row form-actions" id="permissions_submit">
|
53
|
+
<%= button_tag '<i class="icon-save"></i> Save'.html_safe, :type => 'submit', :class => 'btn-primary btn-large', :onclick => "confirmation_needed = false;", :id => "upload_submit", :name => "update_permission" %>
|
54
|
+
</div>
|
51
55
|
|
52
56
|
<% end %>
|
@@ -12,7 +12,7 @@
|
|
12
12
|
}
|
13
13
|
|
14
14
|
// initialize popover helpers
|
15
|
-
$("a[rel=popover]").popover();
|
15
|
+
$("a[rel=popover]").popover({ html: true });
|
16
16
|
<% @terms.each do |term| %>
|
17
17
|
<% vals = @show_file.send(term) %>
|
18
18
|
<% next if vals.blank? %>
|
@@ -20,9 +20,6 @@ $("a[rel=popover]").popover();
|
|
20
20
|
|
21
21
|
<% end %>
|
22
22
|
|
23
|
-
// $(".ajax-form").bind('ajax:success', function(){
|
24
|
-
// var form_id = "#"+this.id;
|
25
|
-
// var key = this.id.replace("form_","");
|
26
23
|
function after_ajax(form_id){
|
27
24
|
var key = form_id.replace("form_","");
|
28
25
|
var save_button = "#"+key+"_save";
|
@@ -33,9 +30,6 @@ $("a[rel=popover]").popover();
|
|
33
30
|
$('#'+form_id).children([".control-group"]).removeClass('hidden')
|
34
31
|
}
|
35
32
|
|
36
|
-
// $(".ajax-form").bind('ajax:before', function(){
|
37
|
-
// var form_id = "#"+this.id;
|
38
|
-
// var key = this.id.replace("form_","");
|
39
33
|
function before_ajax(form_id){
|
40
34
|
var key = form_id.replace("form_","");
|
41
35
|
var save_button = "#"+key+"_save";
|
@@ -45,32 +39,6 @@ $("a[rel=popover]").popover();
|
|
45
39
|
$('#'+form_id).children([".control-group"]).addClass('hidden')
|
46
40
|
}
|
47
41
|
|
48
|
-
// hide permissions to begin with
|
49
|
-
$('#permissions_display').hide();
|
50
|
-
$('#permissions_submit').hide();
|
51
|
-
|
52
|
-
|
53
|
-
// called from edit object view
|
54
|
-
$('#batch_descriptions_link').on('click', function() {
|
55
|
-
$('#batch_descriptions_link').attr('class', 'active');
|
56
|
-
$('#batch_permissions_link').attr('class', '');
|
57
|
-
|
58
|
-
$('#descriptions_display').show();
|
59
|
-
$('#permissions_display').hide();
|
60
|
-
$('#permissions_submit').hide();
|
61
|
-
descriptions_tab();
|
62
|
-
});
|
63
|
-
|
64
|
-
// called from edit object view
|
65
|
-
$('#batch_permissions_link').on('click', function() {
|
66
|
-
$('#batch_permissions_link').attr('class', 'active');
|
67
|
-
$('#batch_descriptions_link').attr('class', '');
|
68
|
-
|
69
|
-
$('#descriptions_display').hide();
|
70
|
-
$('#permissions_display').show();
|
71
|
-
$('#permissions_submit').hide();
|
72
|
-
});
|
73
|
-
|
74
42
|
|
75
43
|
$("tr.expandable").click(function(){
|
76
44
|
$(this).next("ul").slideToggle();
|
@@ -216,52 +184,54 @@ $("a[rel=popover]").popover();
|
|
216
184
|
<h3> Descriptions:</h3>
|
217
185
|
|
218
186
|
<ul class="nav nav-tabs">
|
219
|
-
<li id="
|
220
|
-
<li id="
|
187
|
+
<li id="edit_descriptions_link" class="active"><a href="#descriptions_display" data-toggle="tab"><i class="icon-tags"></i> Descriptions</a></li>
|
188
|
+
<li id="edit_permissions_link"><a href="#permissions_display" data-toggle="tab"><i class="icon-key"></i> Permissions</a></li>
|
221
189
|
</ul>
|
222
|
-
|
223
|
-
<
|
224
|
-
|
225
|
-
|
226
|
-
<%
|
227
|
-
|
228
|
-
<
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
190
|
+
<div class="tab-content">
|
191
|
+
<div class="well tab-pane active" id="descriptions_display">
|
192
|
+
<table class="table table-striped"><!-- class="verticalheadings"> -->
|
193
|
+
<tbody>
|
194
|
+
<% @terms.each do |term| %>
|
195
|
+
<% vals = @show_file.send(term) %>
|
196
|
+
<tr id='row_<%=term.to_s%>' class="expandable">
|
197
|
+
<th width="20%">
|
198
|
+
<a class="accordion-toggle grey" data-toggle="collapse" data-parent="#row_<%=term.to_s%>" href="#collapse_<%=term.to_s%>">
|
199
|
+
<%=get_label(term)%> <i class="toggle icon-chevron-right grey"></i>
|
200
|
+
</a>
|
201
|
+
</th>
|
202
|
+
<td width="50%" class="scrolly">
|
203
|
+
|
204
|
+
<div id="collapse_<%=term.to_s%>" class="accordion-body collapse scrolly">
|
205
|
+
<%= form_for @generic_file, :url=>batch_edits_path, :method=>:put, :remote => true, :html => { :id=>"form_"+term.to_s, :class=>"ajax-form"} do |f| %>
|
206
|
+
<%= hidden_field_tag('update_type', 'update') %>
|
207
|
+
<%= hidden_field_tag('key', term.to_s) %>
|
208
|
+
<%= render :partial => "generic_files/field_form", :locals => { :generic_file => @show_file, :f =>f, :render_req => false, :key => term } %>
|
209
|
+
<div class="row">
|
210
|
+
<%= f.submit "Save changes", :class=>'btn btn-primary field-save' , :id=>term.to_s+'_save'%>
|
211
|
+
<a class="accordion-toggle btn" data-toggle="collapse" data-parent="#row_<%=term.to_s%>" href="#collapse_<%=term.to_s%>">Cancel </a>
|
212
|
+
<div id="status_<%=term.to_s%>" class="status fleft"></div>
|
213
|
+
</div>
|
214
|
+
<% end %>
|
215
|
+
</div>
|
216
|
+
</td>
|
217
|
+
</tr>
|
218
|
+
<% end %>
|
219
|
+
</tbody></table> <!-- class="verticalheadings"> -->
|
220
|
+
</div><!-- /well -->
|
221
|
+
<div id="permissions_display" class="tab-pane">
|
222
|
+
<%= form_for @generic_file, :url=>batch_edits_path, :method=>:put, :remote => true, :html => { :id=>"form_permissions", :class=>"ajax-form"} do |f| %>
|
223
|
+
<%= hidden_field_tag('generic_file[terms_of_service]', '1') %>
|
224
|
+
<%= hidden_field_tag('update_type', 'update') %>
|
225
|
+
<%= hidden_field_tag('key', 'permissions') %>
|
226
|
+
<%= render :partial => "generic_files/permission_form", :locals => { :gf => @show_file } %>
|
227
|
+
<div class="row">
|
228
|
+
<%= f.submit "Save changes", :class=>'btn btn-primary', :id=>'permissions_save' %>
|
229
|
+
<a class="accordion-toggle btn" data-toggle="collapse" data-parent="#row_permissions" href="#collapse_permissions">Cancel </a>
|
230
|
+
<div id="status_permissions" class="status fleft"></div>
|
231
|
+
</div>
|
249
232
|
<% end %>
|
250
|
-
|
251
|
-
|
252
|
-
<div id="permissions_display">
|
253
|
-
<%= form_for @generic_file, :url=>batch_edits_path, :method=>:put, :remote => true, :html => { :id=>"form_permissions", :class=>"ajax-form"} do |f| %>
|
254
|
-
<%= hidden_field_tag('generic_file[terms_of_service]', '1') %>
|
255
|
-
<%= hidden_field_tag('update_type', 'update') %>
|
256
|
-
<%= hidden_field_tag('key', 'permissions') %>
|
257
|
-
<%= render :partial => "generic_files/permission", :locals => { :gf => @show_file, :f=> f } %>
|
258
|
-
<div class="row">
|
259
|
-
<%= f.submit "Save changes", :class=>'btn btn-primary', :id=>'permissions_save' %>
|
260
|
-
<a class="accordion-toggle btn" data-toggle="collapse" data-parent="#row_permissions" href="#collapse_permissions">Cancel </a>
|
261
|
-
<div id="status_permissions" class="status fleft"></div>
|
262
|
-
</div>
|
263
|
-
<% end %>
|
264
|
-
</div>
|
233
|
+
</div>
|
234
|
+
</div> <!-- .tab-content -->
|
265
235
|
|
266
236
|
<!-- Ajax call to clear the batch before page uload. -->
|
267
237
|
<%= button_to "Clear Batch", { :controller => :batch_edits, :action=>:clear }, :form_class=>'hidden' , :remote => true, :id=>'clear_batch' %>
|