sufia 4.3.1 → 5.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +8 -1
- data/Gemfile +10 -1
- data/History.md +14 -0
- data/LICENSE +15 -0
- data/README.md +7 -3
- data/SUFIA_VERSION +1 -1
- data/app/assets/javascripts/sufia.js +17 -1
- data/app/assets/javascripts/sufia/batch_edit.js +28 -43
- data/app/assets/javascripts/sufia/edit_metadata.js +14 -9
- data/app/assets/javascripts/sufia/manage_repeating_fields.js +74 -0
- data/app/assets/stylesheets/sufia.css.scss +1 -1
- data/app/assets/stylesheets/sufia/_batch-edit.scss +8 -0
- data/app/assets/stylesheets/sufia/_file-listing.scss +1 -1
- data/app/assets/stylesheets/sufia/_multi_value_fields.css.scss +67 -0
- data/app/controllers/concerns/sufia/breadcrumbs.rb +8 -3
- data/app/controllers/concerns/sufia/users_controller_behavior.rb +5 -1
- data/app/helpers/generic_file_helper.rb +0 -9
- data/app/helpers/sufia/records_helper_behavior.rb +0 -14
- data/app/inputs/multi_value_input.rb +84 -0
- data/app/views/batch/_metadata.html.erb +4 -16
- data/app/views/batch/edit.html.erb +1 -1
- data/app/views/batch_edits/edit.html.erb +6 -10
- data/app/views/collections/_edit_descriptions.html.erb +1 -1
- data/app/views/collections/_form.html.erb +3 -3
- data/app/views/generic_files/_descriptions.html.erb +9 -7
- data/app/views/generic_files/_field_form.html.erb +23 -8
- data/app/views/generic_files/edit.html.erb +0 -1
- data/app/views/records/_edit_field.html.erb +19 -17
- data/app/views/records/_rights_modal.html.erb +1 -0
- data/app/views/records/edit_fields/_default.html.erb +12 -6
- data/app/views/records/edit_fields/_description.html.erb +3 -6
- data/app/views/records/edit_fields/_resource_type.html.erb +5 -4
- data/app/views/records/edit_fields/_rights.html.erb +2 -5
- data/app/views/records/edit_fields/_suffix.html.erb +0 -11
- data/app/views/records/edit_fields/_type.html.erb +2 -8
- data/config/initializers/simple_form.rb +167 -0
- data/config/initializers/simple_form_bootstrap.rb +137 -0
- data/config/locales/simple_form.en.yml +31 -0
- data/config/locales/sufia.en.yml +2 -0
- data/lib/sufia/version.rb +1 -1
- data/spec/controllers/batch_edits_controller_spec.rb +1 -0
- data/spec/controllers/generic_files_controller_spec.rb +26 -0
- data/spec/controllers/users_controller_spec.rb +4 -3
- data/spec/features/collection_spec.rb +7 -0
- data/spec/helpers/records_helper_spec.rb +0 -13
- data/spec/lib/sufia/breadcrumbs_spec.rb +46 -8
- data/spec/views/collections/_form.html.erb_spec.rb +0 -2
- data/sufia-models/app/models/concerns/sufia/user.rb +5 -0
- data/sufia-models/lib/sufia/models/stats/user_stat_importer.rb +9 -5
- data/sufia-models/lib/sufia/models/version.rb +1 -1
- data/sufia.gemspec +1 -0
- metadata +29 -9
- data/LICENSE.md +0 -14
- data/app/assets/javascripts/sufia/multiForm.js +0 -67
@@ -20,11 +20,10 @@
|
|
20
20
|
case request.referer
|
21
21
|
when /catalog/
|
22
22
|
add_breadcrumb I18n.t('sufia.bread_crumb.search_results'), request.referer
|
23
|
-
when /dashboard/
|
24
|
-
default_trail
|
25
|
-
add_breadcrumb_for_controller
|
26
23
|
else
|
27
24
|
default_trail
|
25
|
+
add_breadcrumb_for_controller
|
26
|
+
add_breadcrumb_for_action
|
28
27
|
end
|
29
28
|
end
|
30
29
|
|
@@ -37,5 +36,11 @@
|
|
37
36
|
end
|
38
37
|
end
|
39
38
|
|
39
|
+
def add_breadcrumb_for_action
|
40
|
+
if /edit|stats/ =~ action_name && controller_name == "generic_files"
|
41
|
+
add_breadcrumb I18n.t("sufia.generic_file.browse_view"), sufia.generic_file_path(Sufia::Noid.noidify params["id"])
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
40
45
|
end
|
41
46
|
end
|
@@ -49,7 +49,7 @@ module Sufia::UsersControllerBehavior
|
|
49
49
|
def update
|
50
50
|
if params[:user]
|
51
51
|
@user.update_attributes(params.require(:user).permit(*User.permitted_attributes))
|
52
|
-
@user.populate_attributes if
|
52
|
+
@user.populate_attributes if update_directory?
|
53
53
|
end
|
54
54
|
|
55
55
|
unless @user.save
|
@@ -65,6 +65,10 @@ module Sufia::UsersControllerBehavior
|
|
65
65
|
redirect_to sufia.profile_path(@user.to_param), notice: "Your profile has been updated"
|
66
66
|
end
|
67
67
|
|
68
|
+
def update_directory?
|
69
|
+
['1', 'true'].include? params[:user][:update_directory]
|
70
|
+
end
|
71
|
+
|
68
72
|
def toggle_trophy
|
69
73
|
id = Sufia::Noid.namespaceize params[:file_id]
|
70
74
|
unless current_user.can? :edit, id
|
@@ -64,15 +64,6 @@ module GenericFileHelper
|
|
64
64
|
end
|
65
65
|
end
|
66
66
|
|
67
|
-
def more_or_less_button(key, html_class, symbol)
|
68
|
-
# TODO, there could be more than one element with this id on the page, but the fuctionality doesn't work without it.
|
69
|
-
content_tag('button', class: "#{html_class} btn", id: "additional_#{key}_submit", name: "additional_#{key}") do
|
70
|
-
(symbol + content_tag('span', class: 'sr-only') do
|
71
|
-
"add another #{key.to_s}"
|
72
|
-
end).html_safe
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
67
|
def download_image_tag title = nil
|
77
68
|
if title.nil?
|
78
69
|
image_tag "default.png", { alt: "No preview available", class: "img-responsive" }
|
@@ -1,12 +1,5 @@
|
|
1
1
|
module Sufia
|
2
2
|
module RecordsHelperBehavior
|
3
|
-
def add_field(key)
|
4
|
-
more_or_less_button(key, 'adder', '+')
|
5
|
-
end
|
6
|
-
|
7
|
-
def subtract_field(key)
|
8
|
-
more_or_less_button(key, 'remover', '-')
|
9
|
-
end
|
10
3
|
|
11
4
|
def help_icon(key, content = nil, title = nil)
|
12
5
|
content = content || metadata_help(key)
|
@@ -40,13 +33,6 @@ module Sufia
|
|
40
33
|
|
41
34
|
private
|
42
35
|
|
43
|
-
def more_or_less_button(key, html_class, symbol)
|
44
|
-
icon = (symbol == "-") ? "remove" : "plus"
|
45
|
-
content_tag "button", class: "#{html_class} btn", id: "additional_#{key}_submit", name: "additional_#{key}" do
|
46
|
-
sr_hidden(icon) + sr_only(key.to_s)
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
36
|
def sr_hidden icon
|
51
37
|
content_tag "span", "aria-hidden" => true do
|
52
38
|
content_tag "i", "", class: "glyphicon glyphicon-#{icon}"
|
@@ -0,0 +1,84 @@
|
|
1
|
+
class MultiValueInput < SimpleForm::Inputs::CollectionInput
|
2
|
+
|
3
|
+
def input(wrapper_options)
|
4
|
+
@rendered_first_element = false
|
5
|
+
input_html_classes.unshift("string")
|
6
|
+
input_html_options[:name] ||= "#{object_name}[#{attribute_name}][]"
|
7
|
+
|
8
|
+
markup = <<-HTML
|
9
|
+
<ul class="listing">
|
10
|
+
HTML
|
11
|
+
|
12
|
+
collection.each_with_index do |value, i|
|
13
|
+
unless value.to_s.strip.blank?
|
14
|
+
markup << <<-HTML
|
15
|
+
<li class="field-wrapper">
|
16
|
+
#{build_field(value)}
|
17
|
+
</li>
|
18
|
+
HTML
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
markup << <<-HTML
|
23
|
+
<li class="field-wrapper">
|
24
|
+
#{build_field('')}
|
25
|
+
</li>
|
26
|
+
</ul>
|
27
|
+
|
28
|
+
HTML
|
29
|
+
end
|
30
|
+
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
def build_field(value)
|
35
|
+
select_opts = options[:collection]
|
36
|
+
options = build_options(value)
|
37
|
+
|
38
|
+
@rendered_first_element = true
|
39
|
+
|
40
|
+
type = options.delete(:type)
|
41
|
+
if type == 'textarea'.freeze
|
42
|
+
@builder.text_area(attribute_name, options)
|
43
|
+
elsif type == 'select'.freeze
|
44
|
+
selected = value.blank? ? :blank : value
|
45
|
+
opts = options.merge(selected: selected)
|
46
|
+
@builder.collection_select(attribute_name, select_opts, :last, :first, opts, opts)
|
47
|
+
else
|
48
|
+
@builder.text_field(attribute_name, options)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def build_options(value)
|
53
|
+
options = input_html_options.dup
|
54
|
+
|
55
|
+
options[:value] = value
|
56
|
+
if @rendered_first_element
|
57
|
+
options[:id] = nil
|
58
|
+
options[:required] = nil
|
59
|
+
else
|
60
|
+
options[:id] ||= input_dom_id
|
61
|
+
end
|
62
|
+
options[:class] ||= []
|
63
|
+
options[:class] += ["#{ input_dom_id } form-control multi-text-field"]
|
64
|
+
options[:'aria-labelledby'] = label_id
|
65
|
+
return options
|
66
|
+
end
|
67
|
+
|
68
|
+
|
69
|
+
def label_id
|
70
|
+
input_dom_id + '_label'
|
71
|
+
end
|
72
|
+
|
73
|
+
def input_dom_id
|
74
|
+
input_html_options[:id] || "#{object_name}_#{attribute_name}"
|
75
|
+
end
|
76
|
+
|
77
|
+
def collection
|
78
|
+
@collection ||= Array(object.send(attribute_name))
|
79
|
+
end
|
80
|
+
|
81
|
+
def multiple?
|
82
|
+
true
|
83
|
+
end
|
84
|
+
end
|
@@ -37,32 +37,20 @@
|
|
37
37
|
<div class="batch-group">
|
38
38
|
<%= f.label :tag, "<span class='required-field'>*</span> Keyword".html_safe, class: "control-label" %>
|
39
39
|
<%= help_icon(:tag) %>
|
40
|
-
|
41
|
-
<%= f.text_field :tag, name: "generic_file[tag][]", value: "", required: true %>
|
42
|
-
<button class="adder btn" name="additional_tag" id="additional_tag_submit"><span aria-hidden="true"><i class="glyphicon glyphicon-plus"></i></span><span class="sr-only"><%= t('sufia.batch.metadata.add_another_keyword') %></span></button>
|
43
|
-
</div>
|
44
|
-
<div id="additional_tag_elements"></div>
|
40
|
+
<%= f.input :tag, label: false, as: :multi_value %>
|
45
41
|
</div>
|
46
42
|
|
47
43
|
<div class="batch-group">
|
48
44
|
<%= f.label :creator, "<span class='required-field'>*</span> Creator".html_safe, class: "control-label" %>
|
49
45
|
<%= help_icon(:creator) %>
|
50
|
-
|
51
|
-
<%= f.text_field :creator, name: "generic_file[creator][]", value: "", required: true %>
|
52
|
-
<button class="adder btn" name="additional_creator" id="additional_creator_submit"><span aria-hidden="true"><i class="glyphicon glyphicon-plus"></i></span><span class="sr-only"><%= t('sufia.batch.metadata.add_another_creator') %></span></button>
|
53
|
-
</div>
|
54
|
-
<div id="additional_creator_elements"></div>
|
46
|
+
<%= f.input :creator, label: false, as: :multi_value %>
|
55
47
|
</div>
|
56
48
|
|
57
49
|
<div class="batch-group">
|
58
50
|
<%= f.label :rights, '<span class="required-field">*</span> Rights'.html_safe, class: "control-label" %>
|
59
51
|
<%= help_icon_modal('rightsModal') %>
|
60
|
-
|
61
|
-
|
62
|
-
<button class="adder btn" name="additional_rights" id="additional_rights_submit"><span aria-hidden="true"><i class="glyphicon glyphicon-plus"></i></span><span class="sr-only"><%= t('sufia.batch.metadata.add_another_rights') %></span></button>
|
63
|
-
<%= render partial: "generic_files/rights_modal" %>
|
64
|
-
</div>
|
65
|
-
<div id="additional_rights_elements"></div>
|
52
|
+
<%= f.input :rights, label: false, as: :multi_value, collection: Sufia.config.cc_licenses, include_blank: true, input_html: { type: 'select', class: 'select optional form-control' } %>
|
53
|
+
<%= render partial: "generic_files/rights_modal" %>
|
66
54
|
</div>
|
67
55
|
|
68
56
|
<button id="show_addl_descriptions" class="btn btn-default" aria-label="reveal additional metadata description fields">Show Additional Fields</button>
|
@@ -10,7 +10,7 @@
|
|
10
10
|
<%= link_to "<i class='glyphicon glyphicon-dashboard'></i> #{t('sufia.bread_crumb.file_list')}".html_safe, sufia.dashboard_files_path %>
|
11
11
|
once this step is finished. <span class="required-field">*</span> indicates required fields.
|
12
12
|
</p>
|
13
|
-
<%=
|
13
|
+
<%= simple_form_for([@batch, @generic_file], url: sufia.batch_generic_files_path, html: { multipart: true, class: 'form-horizontal' }) do |f| %>
|
14
14
|
|
15
15
|
<%= render partial: 'metadata', formats: [:html], locals: {f: f} %>
|
16
16
|
|
@@ -19,24 +19,21 @@
|
|
19
19
|
<div class="row">
|
20
20
|
<!-- look into dashboard_actions.js -->
|
21
21
|
<div class="col-sm-2 col-sm-offset-1">
|
22
|
-
<a class="accordion-toggle grey glyphicon-chevron-right-helper" data-toggle="collapse" data-parent="#row_<%= term.to_s %>" href="#" id="expand_link_<%=term.to_s%>">
|
23
|
-
<%= get_label(term) %>
|
22
|
+
<a class="accordion-toggle grey glyphicon-chevron-right-helper collapsed" data-toggle="collapse" data-parent="#row_<%= term.to_s %>" href="#collapse_<%= term %>" id="expand_link_<%=term.to_s%>">
|
23
|
+
<%= get_label(term) %> <span class="chevron"></span>
|
24
24
|
</a>
|
25
|
-
<a href="#collapse_<%=term.to_s%>" class="small" id="chevron_link_<%=term.to_s%>"><span id="expand_<%=term.to_s%>" class="glyphicon glyphicon-chevron-right"></span></a>
|
26
25
|
</div>
|
27
|
-
<div id="
|
28
|
-
|
29
|
-
<%= form_for @generic_file, url: batch_edits_path, method: :put, remote: true, html: { id: "form_#{term.to_s}", class: "ajax-form"} do |f| %>
|
26
|
+
<div id="collapse_<%= term.to_s %>" class="collapse scrolly col-sm-6">
|
27
|
+
<%= simple_form_for @generic_file, url: batch_edits_path, method: :put, remote: true, html: { id: "form_#{term.to_s}", class: "ajax-form"} do |f| %>
|
30
28
|
<%= hidden_field_tag('update_type', 'update') %>
|
31
29
|
<%= hidden_field_tag('key', term.to_s) %>
|
32
30
|
<%= render partial: "generic_files/field_form", locals: { generic_file: @show_file, f: f, render_req: false, key: term } %>
|
33
31
|
<div>
|
34
32
|
<%= f.submit "Save changes", class: 'btn btn-primary field-save updates-batches' , id: "#{term.to_s}_save" %>
|
35
|
-
<a class="
|
33
|
+
<a class="btn btn-default" data-toggle="collapse" data-parent="#row_<%= term.to_s %>" href="#collapse_<%= term.to_s %>">Cancel </a>
|
36
34
|
<div id="status_<%= term.to_s %>" class="status fleft"></div>
|
37
35
|
</div>
|
38
36
|
<% end %>
|
39
|
-
</div>
|
40
37
|
</div>
|
41
38
|
</div>
|
42
39
|
<% end %>
|
@@ -49,7 +46,6 @@
|
|
49
46
|
<%= render partial: "generic_files/permission_form", locals: { gf: @show_file } %>
|
50
47
|
<div class="row">
|
51
48
|
<%= f.submit "Save changes", class: 'btn btn-primary updates-batches', id: 'permissions_save' %>
|
52
|
-
<a class="accordion-toggle btn" data-toggle="collapse" data-parent="#row_permissions" href="#collapse_permissions">Cancel </a>
|
53
49
|
<div id="status_permissions" class="status fleft"></div>
|
54
50
|
</div>
|
55
51
|
<% end %>
|
@@ -59,4 +55,4 @@
|
|
59
55
|
<!-- Ajax call to clear the batch before page uload. -->
|
60
56
|
<%= button_to "Clear Batch", { controller: :batch_edits, action: :clear }, form_class: 'hidden', remote: true, id: 'clear_batch' %>
|
61
57
|
|
62
|
-
</div><!-- descriptions_display -->
|
58
|
+
</div><!-- descriptions_display -->
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<%# This mimics the generic_files/descriptions partial & re-uses some of its sub-partials %>
|
2
2
|
<div id="descriptions_display" class="tab-pane active">
|
3
|
-
<%=
|
3
|
+
<%= simple_form_for collection, url: collections.collection_path, html: {multipart: true, class: 'form-horizontal'} do |f| %>
|
4
4
|
<%= hidden_field_tag('redirect_tab', 'descriptions') %>
|
5
5
|
<h2 class="non lower">Descriptions <small class="pull-right"><span class="error">*</span> indicates required fields</small> </h2>
|
6
6
|
<div class="well">
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<%=
|
1
|
+
<%= simple_form_for [collections, @collection], html: {class: 'form-horizontal editor'} do |f| %>
|
2
2
|
<div id="descriptions_display">
|
3
3
|
<h2 class="non lower">Descriptions <small class="pull-right"><span class="error">*</span> indicates required fields</small> </h2>
|
4
4
|
<div class="well">
|
@@ -16,9 +16,9 @@
|
|
16
16
|
|
17
17
|
<div class="primary-actions">
|
18
18
|
<% if params[:action] == "new" %>
|
19
|
-
<%= f.
|
19
|
+
<%= f.button_button 'Create Collection', type: 'submit', class: 'btn btn-primary', onclick: "confirmation_needed = false;", id: "create_submit", name: "create_collection" %>
|
20
20
|
<% else %>
|
21
|
-
<%= f.
|
21
|
+
<%= f.button_button 'Update Collection', type: 'submit', class: 'btn btn-primary', onclick: "confirmation_needed = false;", id: "update_submit", name: "update_collection" %>
|
22
22
|
<% end %>
|
23
23
|
<%= link_to t(:'helpers.action.cancel'), main_app.root_path, class: 'btn btn-link' %>
|
24
24
|
</div>
|
@@ -2,18 +2,20 @@
|
|
2
2
|
<% generic_file ||= @generic_file %>
|
3
3
|
|
4
4
|
<div id="descriptions_display" class="tab-pane active">
|
5
|
-
<%=
|
5
|
+
<%= simple_form_for generic_file, url: sufia.generic_file_path(@generic_file), html: { multipart: true } do |f| %>
|
6
6
|
<%= hidden_field_tag('redirect_tab', 'descriptions') %>
|
7
7
|
<h1>Descriptions <span class="pull-right required-field">* indicates required fields</span></h1>
|
8
|
-
<div class="well">
|
9
8
|
|
10
|
-
|
11
|
-
|
12
|
-
|
9
|
+
<div class="well">
|
10
|
+
<% (generic_file.terms_for_editing).each do |term| %>
|
11
|
+
<%= render partial: "records/edit_field", locals: { record: generic_file, f: f, render_req: true, key: term } %>
|
12
|
+
<% end %>
|
13
|
+
</div>
|
13
14
|
|
14
|
-
</div><!-- /well -->
|
15
15
|
<div class="action-button">
|
16
|
-
<%= f.
|
16
|
+
<%= f.button_button :submit, class: 'btn btn-primary', onclick: "confirmation_needed = false;", id: "upload_submit", name: "update_descriptions" do %>
|
17
|
+
<%= '<i class="glyphicon glyphicon-floppy-disk"></i> Save Descriptions'.html_safe %>
|
18
|
+
<% end %>
|
17
19
|
</div>
|
18
20
|
<% end %>
|
19
21
|
</div>
|
@@ -1,6 +1,11 @@
|
|
1
|
-
<% render_req ||= true # render_req is true for single file edit, false for batch edit%>
|
1
|
+
<% render_req ||= true # render_req is true for single file edit, false for batch edit %>
|
2
|
+
|
3
|
+
<% record = generic_file %>
|
4
|
+
|
2
5
|
<div class="batch-group">
|
3
|
-
<%
|
6
|
+
<% required = render_req && record.required?(key) %>
|
7
|
+
<% single = f.object.class.unique?(key) %>
|
8
|
+
|
4
9
|
<% if render_req && required?(key) %>
|
5
10
|
<% tmp = '<span class="required-field">*</span>' + get_label(key) %>
|
6
11
|
<%= f.label key, tmp.html_safe %>
|
@@ -8,12 +13,22 @@
|
|
8
13
|
<%= f.label key, get_label(key) %>
|
9
14
|
<% end %>
|
10
15
|
<%= help_icon(key) %>
|
11
|
-
|
12
|
-
|
13
|
-
|
16
|
+
|
17
|
+
<% if partial_exists?("generic_files/edit_fields/_#{key}") ||
|
18
|
+
partial_exists?("records/edit_fields/_#{key}") %>
|
19
|
+
<%= render_edit_field_partial(key, f: f, record: record, required: required, label_for_field: false, single: single) %>
|
14
20
|
<% else %>
|
15
|
-
<%
|
16
|
-
|
21
|
+
<% opts = { label: false, required: required } %>
|
22
|
+
|
23
|
+
<% if single %>
|
24
|
+
<% opts = opts.merge(input_html: { class: 'listing' }) %>
|
25
|
+
<div class='single_value'>
|
26
|
+
<%= f.input key, opts %>
|
27
|
+
</div>
|
28
|
+
<% else %>
|
29
|
+
<% opts = opts.merge(as: :multi_value) %>
|
30
|
+
<%= f.input key, opts %>
|
17
31
|
<% end %>
|
32
|
+
|
18
33
|
<% end %>
|
19
|
-
|
34
|
+
</div>
|
@@ -10,7 +10,6 @@
|
|
10
10
|
<%= render partial: 'media_display' %>
|
11
11
|
</div>
|
12
12
|
<div class="col-xs-12 col-sm-8">
|
13
|
-
<%= link_to "<<Browse view".html_safe, sufia.generic_file_path(@generic_file) %>
|
14
13
|
<ul class="nav nav-tabs">
|
15
14
|
<li id="edit_descriptions_link" class="active">
|
16
15
|
<a href="#descriptions_display" data-toggle="tab"><i class="glyphicon glyphicon-tags"></i> Descriptions</a>
|
@@ -1,22 +1,24 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
# 'render_edit_field_partial' in sufia that uses 'generic_file' as the action. %>
|
4
|
-
<% render_req ||= true # render_req is true for single file edit, false for batch edit%>
|
1
|
+
<% render_req ||= true # render_req is true for single file edit, false for batch edit %>
|
2
|
+
|
5
3
|
<div class="form-group">
|
6
|
-
<%
|
7
|
-
<%
|
8
|
-
|
9
|
-
<%= f.label key, tmp.html_safe %>
|
10
|
-
<% else %>
|
11
|
-
<%= f.label key, get_label(key) %>
|
12
|
-
<% end %>
|
4
|
+
<% required = render_req && record.required?(key) %>
|
5
|
+
<% lbl = get_label(key) %>
|
6
|
+
<% single = f.object.class.unique?(key) %>
|
13
7
|
|
14
|
-
<% if key
|
15
|
-
|
16
|
-
<%= render_edit_field_partial(key, record: record, f: f, render_req: render_req) %>
|
8
|
+
<% if partial_exists?("records/edit_fields/_#{key}") %>
|
9
|
+
<%= render_edit_field_partial(key, f: f, record: record, required: required, label_for_field: lbl, single: single) %>
|
17
10
|
<% else %>
|
18
|
-
<%
|
19
|
-
|
11
|
+
<% opts = { label: lbl, required: required } %>
|
12
|
+
|
13
|
+
<% if single %>
|
14
|
+
<% opts = opts.merge(input_html: { class: 'listing' }) %>
|
15
|
+
<div class='single_value'>
|
16
|
+
<%= f.input key, opts %>
|
17
|
+
</div>
|
18
|
+
<% else %>
|
19
|
+
<% opts = opts.merge(as: :multi_value) %>
|
20
|
+
<%= f.input key, opts %>
|
20
21
|
<% end %>
|
22
|
+
|
21
23
|
<% end %>
|
22
|
-
</div
|
24
|
+
</div>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render partial: "generic_files/rights_modal" %>
|
@@ -1,6 +1,12 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
1
|
+
<div>
|
2
|
+
<% required = render_req && record.required?(key) %>
|
3
|
+
<% lbl = get_label(key) %>
|
4
|
+
<% single = f.object.class.unique?(key) %>
|
5
|
+
|
6
|
+
<% opts = { label: lbl, required: required } %>
|
7
|
+
<% opts = opts.merge(as: :multi_value) unless single %>
|
8
|
+
|
9
|
+
<%= f.input key, opts %>
|
10
|
+
|
11
|
+
<%= render partial: "records/edit_fields/suffix", locals: { key: key, index: index, single: f.object.class.unique?(key) } %>
|
12
|
+
</div>
|
@@ -1,6 +1,3 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
<%= render partial: "records/edit_fields/suffix", locals: { key: key, index: index, single: f.object.class.unique?(key)} %>
|
5
|
-
</div>
|
6
|
-
<div id="additional_<%= key %>_elements"></div>
|
1
|
+
<% render_req ||= false %>
|
2
|
+
<% required = render_req && record.required?(key) %>
|
3
|
+
<%= f.input key, label: label_for_field, as: :multi_value, required: required, input_html: { rows: '5', type: 'textarea'} %>
|