sufia 5.0.0 → 6.0.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -8
- data/Gemfile +3 -12
- data/History.md +0 -36
- data/LICENSE.md +14 -0
- data/README.md +4 -8
- data/SUFIA_VERSION +1 -1
- data/app/assets/javascripts/sufia.js +1 -17
- data/app/assets/javascripts/sufia/batch_edit.js +43 -28
- data/app/assets/javascripts/sufia/edit_metadata.js +9 -14
- data/app/assets/javascripts/sufia/multiForm.js +67 -0
- data/app/assets/javascripts/sufia/permissions.js +92 -35
- data/app/assets/stylesheets/sufia.css.scss +1 -6
- data/app/assets/stylesheets/sufia/_batch-edit.scss +0 -8
- data/app/assets/stylesheets/sufia/_dashboard.scss +1 -15
- data/app/assets/stylesheets/sufia/_file-listing.scss +1 -1
- data/app/assets/stylesheets/sufia/_settings.scss +0 -1
- data/app/controllers/concerns/sufia/batch_edits_controller_behavior.rb +3 -10
- data/app/controllers/concerns/sufia/breadcrumbs.rb +3 -8
- data/app/controllers/concerns/sufia/catalog.rb +1 -1
- data/app/controllers/concerns/sufia/controller.rb +3 -1
- data/app/controllers/concerns/sufia/downloads_controller_behavior.rb +1 -1
- data/app/controllers/concerns/sufia/files_controller/browse_everything.rb +1 -1
- data/app/controllers/concerns/sufia/files_controller_behavior.rb +16 -4
- data/app/controllers/concerns/sufia/homepage_controller.rb +1 -1
- data/app/controllers/concerns/sufia/my_controller_behavior.rb +2 -2
- data/app/controllers/concerns/sufia/transfers_controller_behavior.rb +3 -4
- data/app/controllers/concerns/sufia/users_controller_behavior.rb +2 -7
- data/app/controllers/my/collections_controller.rb +3 -4
- data/app/controllers/my/highlights_controller.rb +2 -2
- data/app/controllers/my/shares_controller.rb +3 -3
- data/app/controllers/single_use_links_controller.rb +5 -9
- data/app/controllers/single_use_links_viewer_controller.rb +4 -4
- data/app/helpers/generic_file_helper.rb +9 -0
- data/app/helpers/sufia/records_helper_behavior.rb +16 -0
- data/app/helpers/sufia/sufia_helper_behavior.rb +0 -11
- data/app/jobs/content_depositor_change_event_job.rb +1 -1
- data/app/jobs/ingest_local_file_job.rb +2 -1
- data/app/models/concerns/sufia/solr_document_behavior.rb +10 -10
- data/app/models/featured_work_list.rb +7 -9
- data/app/presenters/sufia/version_list_presenter.rb +15 -0
- data/app/presenters/sufia/version_presenter.rb +30 -0
- data/app/views/batch/_metadata.html.erb +51 -29
- data/app/views/batch/_more_metadata.html.erb +1 -1
- data/app/views/batch/edit.html.erb +10 -8
- data/app/views/batch_edits/edit.html.erb +13 -9
- data/app/views/collections/_edit_descriptions.html.erb +1 -1
- data/app/views/collections/_form.html.erb +4 -4
- data/app/views/collections/_form_for_select_collection.html.erb +1 -1
- data/app/views/collections/_show_document_list_menu.html.erb +7 -5
- data/app/views/collections/_show_document_list_row.html.erb +2 -2
- data/app/views/collections/edit.html.erb +0 -1
- data/app/views/collections/edit_fields/_description.html.erb +4 -0
- data/app/views/collections/edit_fields/_title.html.erb +3 -0
- data/app/views/collections/show.html.erb +0 -1
- data/app/views/dashboard/_index_partials/_stats.html.erb +3 -3
- data/app/views/generic_files/_descriptions.html.erb +9 -9
- data/app/views/generic_files/_field_form.html.erb +11 -25
- data/app/views/generic_files/_permission.html.erb +6 -4
- data/app/views/generic_files/_permission_form.html.erb +15 -17
- data/app/views/generic_files/_show_details.html.erb +1 -11
- data/app/views/generic_files/_versioning.html.erb +5 -5
- data/app/views/generic_files/edit.html.erb +5 -4
- data/app/views/generic_files/show.html.erb +6 -6
- data/app/views/homepage/_featured_fields.html.erb +2 -2
- data/app/views/homepage/_recent_document.html.erb +1 -1
- data/app/views/layouts/_head_tag_content.html.erb +0 -2
- data/app/views/layouts/error.html.erb +0 -1
- data/app/views/my/_index_partials/_default_group.html.erb +1 -1
- data/app/views/my/_index_partials/_list_files.html.erb +1 -1
- data/app/views/my/index.html.erb +2 -2
- data/app/views/records/_edit_field.html.erb +17 -19
- data/app/views/records/edit_fields/_default.html.erb +10 -12
- data/app/views/records/edit_fields/_description.html.erb +10 -3
- data/app/views/records/edit_fields/_resource_type.html.erb +4 -5
- data/app/views/records/edit_fields/_rights.html.erb +9 -2
- data/app/views/records/edit_fields/_suffix.html.erb +10 -0
- data/app/views/records/edit_fields/_type.html.erb +8 -2
- data/app/views/records/show_fields/_based_near.html.erb +1 -1
- data/app/views/records/show_fields/_creator.html.erb +1 -1
- data/app/views/records/show_fields/_language.html.erb +1 -1
- data/app/views/records/show_fields/_publisher.html.erb +1 -1
- data/app/views/records/show_fields/_resource_type.html.erb +1 -1
- data/app/views/records/show_fields/_subject.html.erb +1 -1
- data/app/views/records/show_fields/_tag.html.erb +1 -1
- data/app/views/single_use_links/new_download.html.erb +2 -2
- data/app/views/users/_profile.html.erb +2 -1
- data/app/views/users/_social_media_info.html.erb +20 -0
- data/app/views/users/_user_info.html.erb +3 -20
- data/app/views/users/edit.html.erb +2 -11
- data/app/views/users/show.html.erb +1 -1
- data/bin/audit_repository +1 -1
- data/config/initializers/sufia_events.rb +4 -4
- data/config/locales/sufia.en.yml +0 -5
- data/config/routes.rb +1 -1
- data/lib/generators/sufia/install_generator.rb +0 -4
- data/lib/generators/sufia/templates/catalog_controller.rb +59 -59
- data/lib/sufia.rb +1 -4
- data/lib/sufia/version.rb +1 -1
- data/spec/actors/generic_file/actor_spec.rb +67 -8
- data/spec/controllers/batch_controller_spec.rb +72 -86
- data/spec/controllers/batch_edits_controller_spec.rb +17 -19
- data/spec/controllers/catalog_controller_spec.rb +16 -24
- data/spec/controllers/collections_controller_spec.rb +47 -74
- data/spec/controllers/downloads_controller_spec.rb +40 -35
- data/spec/controllers/generic_files_controller_spec.rb +363 -428
- data/spec/controllers/homepage_controller_spec.rb +12 -9
- data/spec/controllers/mailbox_controller_spec.rb +1 -4
- data/spec/controllers/my/files_controller_spec.rb +0 -10
- data/spec/controllers/single_use_links_controller_spec.rb +28 -35
- data/spec/controllers/single_use_links_viewer_controller_spec.rb +27 -41
- data/spec/controllers/transfers_controller_spec.rb +6 -6
- data/spec/controllers/users_controller_spec.rb +121 -124
- data/spec/factories/generic_files.rb +9 -17
- data/spec/features/browse_dashboard_files_spec.rb +8 -10
- data/spec/features/browse_files_spec.rb +12 -25
- data/spec/features/catalog_search_spec.rb +49 -49
- data/spec/features/collection_spec.rb +18 -24
- data/spec/features/contact_form_spec.rb +26 -20
- data/spec/features/ingest_upload_files_spec.rb +8 -6
- data/spec/features/ownership_transfer_spec.rb +2 -6
- data/spec/features/proxy_spec.rb +1 -1
- data/spec/features/search_spec.rb +2 -3
- data/spec/features/single_use_links_spec.rb +1 -1
- data/spec/features/users_spec.rb +1 -1
- data/spec/helpers/records_helper_spec.rb +24 -10
- data/spec/jobs/active_fedora_pid_based_job_spec.rb +1 -5
- data/spec/jobs/audit_job_spec.rb +66 -21
- data/spec/jobs/batch_update_job_spec.rb +49 -36
- data/spec/jobs/content_depositor_change_event_job_spec.rb +2 -4
- data/spec/jobs/create_derivatives_job_spec.rb +18 -19
- data/spec/jobs/event_jobs_spec.rb +17 -21
- data/spec/jobs/import_url_job_spec.rb +1 -6
- data/spec/jobs/ingest_local_file_job_spec.rb +0 -4
- data/spec/lib/sufia/breadcrumbs_spec.rb +8 -46
- data/spec/lib/sufia/id_service_spec.rb +8 -3
- data/spec/lib/sufia/user_stat_importer_spec.rb +18 -25
- data/spec/lib/sufia/writable_permissions_spec.rb +0 -4
- data/spec/models/ability_spec.rb +25 -18
- data/spec/models/batch_spec.rb +16 -45
- data/spec/models/characterization_spec.rb +1 -1
- data/spec/models/checksum_audit_log_spec.rb +51 -29
- data/spec/models/collection_spec.rb +0 -5
- data/spec/models/featured_work_list_spec.rb +2 -4
- data/spec/models/file_content_datastream_spec.rb +27 -60
- data/spec/models/file_usage_spec.rb +16 -21
- data/spec/models/fits_datastream_spec.rb +47 -2
- data/spec/models/generic_file/web_form_spec.rb +1 -1
- data/spec/models/generic_file_spec.rb +238 -735
- data/spec/models/local_authority_spec.rb +8 -13
- data/spec/models/proxy_deposit_request_spec.rb +3 -7
- data/spec/models/single_use_link_spec.rb +12 -16
- data/spec/models/solr_document_spec.rb +1 -1
- data/spec/models/trophy_spec.rb +1 -3
- data/spec/models/user_spec.rb +47 -75
- data/spec/presenters/sufia/version_list_presenter_spec.rb +22 -0
- data/spec/presenters/sufia/version_presenter_spec.rb +51 -0
- data/spec/services/generic_file_audit_service_spec.rb +85 -0
- data/spec/services/repository_audit_service_spec.rb +18 -0
- data/spec/spec_helper.rb +26 -7
- data/spec/support/fixture_helpers.rb +2 -4
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +0 -4
- data/spec/views/batch/edit.html.erb_spec.rb +17 -7
- data/spec/views/catalog/index.html.erb_spec.rb +8 -6
- data/spec/views/collections/_form.html.erb_spec.rb +4 -2
- data/spec/views/collections/_show_document_list.erb_spec.rb +31 -0
- data/spec/views/dashboard/index_spec.rb +2 -2
- data/spec/views/generic_file/edit.html.erb_spec.rb +20 -6
- data/spec/views/generic_file/show.html.erb_spec.rb +3 -3
- data/spec/views/users/show.html.erb_spec.rb +1 -1
- data/sufia-models/app/actors/sufia/generic_file/actor.rb +8 -10
- data/sufia-models/app/jobs/active_fedora_pid_based_job.rb +2 -3
- data/sufia-models/app/jobs/audit_job.rb +46 -32
- data/sufia-models/app/jobs/batch_update_job.rb +9 -8
- data/sufia-models/app/jobs/import_url_job.rb +2 -2
- data/sufia-models/app/models/batch.rb +11 -12
- data/sufia-models/app/models/checksum_audit_log.rb +12 -10
- data/sufia-models/app/models/concerns/sufia/ability.rb +4 -6
- data/sufia-models/app/models/concerns/sufia/collection.rb +4 -5
- data/sufia-models/app/models/concerns/sufia/generic_file.rb +3 -86
- data/sufia-models/app/models/concerns/sufia/generic_file/batches.rb +29 -0
- data/sufia-models/app/models/concerns/sufia/generic_file/characterization.rb +3 -3
- data/sufia-models/app/models/concerns/sufia/generic_file/content.rb +13 -0
- data/sufia-models/app/models/concerns/sufia/generic_file/derivatives.rb +5 -5
- data/sufia-models/app/models/concerns/sufia/generic_file/export.rb +4 -0
- data/sufia-models/app/models/concerns/sufia/generic_file/full_text_indexing.rb +2 -2
- data/sufia-models/app/models/concerns/sufia/generic_file/indexing.rb +23 -0
- data/sufia-models/app/models/concerns/sufia/generic_file/metadata.rb +80 -11
- data/sufia-models/app/models/concerns/sufia/generic_file/proxy_deposit.rb +12 -3
- data/sufia-models/app/models/concerns/sufia/generic_file/versions.rb +4 -4
- data/sufia-models/app/models/concerns/sufia/generic_file/web_form.rb +14 -6
- data/sufia-models/app/models/concerns/sufia/model_methods.rb +11 -9
- data/sufia-models/app/models/concerns/sufia/user.rb +11 -33
- data/sufia-models/app/models/datastreams/file_content_datastream.rb +1 -1
- data/sufia-models/app/models/datastreams/fits_datastream.rb +1 -1
- data/sufia-models/app/models/file_usage.rb +3 -3
- data/sufia-models/app/models/local_authority.rb +2 -2
- data/sufia-models/app/models/proxy_deposit_request.rb +1 -1
- data/sufia-models/app/services/sufia/generic_file_audit_service.rb +83 -0
- data/sufia-models/app/services/sufia/id_service.rb +5 -5
- data/sufia-models/app/services/sufia/noid.rb +10 -7
- data/sufia-models/app/services/sufia/repository_audit_service.rb +9 -0
- data/sufia-models/lib/generators/sufia/models/cached_stats_generator.rb +47 -3
- data/sufia-models/lib/generators/sufia/models/install_generator.rb +31 -11
- data/sufia-models/lib/generators/sufia/models/proxies_generator.rb +31 -2
- data/sufia-models/lib/generators/sufia/models/templates/config/sufia.rb +10 -0
- data/sufia-models/lib/generators/sufia/models/upgrade400_generator.rb +33 -2
- data/sufia-models/lib/sufia/models/engine.rb +13 -4
- data/sufia-models/lib/sufia/models/file_content/versions.rb +9 -11
- data/sufia-models/lib/sufia/models/stats/user_stat_importer.rb +5 -9
- data/sufia-models/lib/sufia/models/version.rb +1 -1
- data/sufia-models/lib/sufia/permissions/writable.rb +34 -16
- data/sufia-models/sufia-models.gemspec +4 -2
- data/sufia.gemspec +4 -5
- data/tasks/jetty.rake +0 -26
- data/tasks/sufia-dev.rake +14 -2
- metadata +49 -64
- data/LICENSE +0 -15
- data/app/assets/images/orcid.png +0 -0
- data/app/assets/javascripts/sufia/manage_repeating_fields.js +0 -74
- data/app/assets/stylesheets/sufia/_multi_value_fields.css.scss +0 -67
- data/app/inputs/multi_value_input.rb +0 -84
- data/app/views/records/_rights_modal.html.erb +0 -1
- data/config/initializers/simple_form.rb +0 -167
- data/config/initializers/simple_form_bootstrap.rb +0 -137
- data/config/locales/simple_form.en.yml +0 -31
- data/fedora_conf/conf/development/fedora.fcfg +0 -946
- data/fedora_conf/conf/test/fedora.fcfg +0 -946
- data/spec/models/generic_file/reload_on_save_spec.rb +0 -25
- data/spec/models/generic_file_rdf_datastream_spec.rb +0 -12
- data/spec/models/properties_datastream_spec.rb +0 -41
- data/spec/views/generic_file/_permission_form.html.erb_spec.rb +0 -19
- data/sufia-models/app/models/concerns/sufia/generic_file/audit.rb +0 -116
- data/sufia-models/app/models/concerns/sufia/generic_file/reload_on_save.rb +0 -18
- data/sufia-models/app/models/concerns/sufia/properties_datastream_behavior.rb +0 -32
- data/sufia-models/app/models/datastreams/batch_rdf_datastream.rb +0 -6
- data/sufia-models/app/models/datastreams/generic_file_rdf_datastream.rb +0 -69
- data/sufia-models/app/models/datastreams/paranoid_rights_datastream.rb +0 -22
- data/sufia-models/app/models/datastreams/properties_datastream.rb +0 -4
- data/sufia-models/app/models/sufia/orcid_validator.rb +0 -8
- data/sufia-models/lib/generators/sufia/models/abstract_migration_generator.rb +0 -30
- data/sufia-models/lib/generators/sufia/models/orcid_field_generator.rb +0 -19
- data/sufia-models/lib/generators/sufia/models/templates/migrations/add_orcid_to_users.rb +0 -5
- data/sufia-models/lib/generators/sufia/models/user_stats_generator.rb +0 -31
data/LICENSE
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
##########################################################################
|
2
|
-
# Copyright 2012 Penn State University
|
3
|
-
# Additional copyright may be held by others, as reflected in the commit log
|
4
|
-
#
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
# you may not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
# See the License for the specific language governing permissions and
|
15
|
-
# limitations under the License.
|
data/app/assets/images/orcid.png
DELETED
Binary file
|
@@ -1,74 +0,0 @@
|
|
1
|
-
// This widget manages the adding and removing of repeating fields.
|
2
|
-
// There are a lot of assumptions about the structure of the classes and elements.
|
3
|
-
// These assumptions are reflected in the MultiValueInput class.
|
4
|
-
|
5
|
-
(function($){
|
6
|
-
$.widget( "curate.manage_fields", {
|
7
|
-
options: {
|
8
|
-
change: null,
|
9
|
-
add: null,
|
10
|
-
remove: null
|
11
|
-
},
|
12
|
-
|
13
|
-
_create: function() {
|
14
|
-
this.element.addClass("managed");
|
15
|
-
$('.field-wrapper', this.element).addClass("input-group input-append");
|
16
|
-
|
17
|
-
this.controls = $("<span class=\"input-group-btn field-controls\">");
|
18
|
-
this.remover = $("<button class=\"btn btn-danger remove\"><i class=\"icon-white glyphicon-minus\"></i><span>Remove</span></button>");
|
19
|
-
this.adder = $("<button class=\"btn btn-success add\"><i class=\"icon-white glyphicon-plus\"></i><span>Add</span></button>");
|
20
|
-
|
21
|
-
$('.field-wrapper', this.element).append(this.controls);
|
22
|
-
$('.field-wrapper:not(:last-child) .field-controls', this.element).append(this.remover);
|
23
|
-
$('.field-controls:last', this.element).append(this.adder);
|
24
|
-
|
25
|
-
this._on( this.element, {
|
26
|
-
"click .remove": "remove_from_list",
|
27
|
-
"click .add": "add_to_list"
|
28
|
-
});
|
29
|
-
},
|
30
|
-
|
31
|
-
add_to_list: function( event ) {
|
32
|
-
event.preventDefault();
|
33
|
-
|
34
|
-
var $activeField = $(event.target).parents('.field-wrapper'),
|
35
|
-
$activeFieldControls = $activeField.children('.field-controls'),
|
36
|
-
$removeControl = this.remover.clone(),
|
37
|
-
$newField = $activeField.clone(),
|
38
|
-
$listing = $('.listing', this.element),
|
39
|
-
$warningMessage = $("<div class=\'message has-warning\'>cannot add new empty field</div>");
|
40
|
-
if ($activeField.children('input').val() === '') {
|
41
|
-
$listing.children('.has-warning').remove();
|
42
|
-
$listing.append($warningMessage);
|
43
|
-
}
|
44
|
-
else{
|
45
|
-
$listing.children('.has-warning').remove();
|
46
|
-
$('.add', $activeFieldControls).remove();
|
47
|
-
$activeFieldControls.prepend($removeControl);
|
48
|
-
$newChildren = $newField.find('input');
|
49
|
-
$newChildren.
|
50
|
-
val('').
|
51
|
-
removeProp('required');
|
52
|
-
$listing.append($newField);
|
53
|
-
$newChildren.first().focus();
|
54
|
-
this._trigger("add",$newChildren);
|
55
|
-
}
|
56
|
-
},
|
57
|
-
|
58
|
-
remove_from_list: function( event ) {
|
59
|
-
event.preventDefault();
|
60
|
-
|
61
|
-
$(event.target)
|
62
|
-
.parents('.field-wrapper')
|
63
|
-
.remove();
|
64
|
-
|
65
|
-
this._trigger("remove");
|
66
|
-
},
|
67
|
-
|
68
|
-
_destroy: function() {
|
69
|
-
this.actions.remove();
|
70
|
-
$('.field-wrapper', this.element).removeClass("input-append");
|
71
|
-
this.element.removeClass( "managed" );
|
72
|
-
}
|
73
|
-
});
|
74
|
-
})(jQuery);
|
@@ -1,67 +0,0 @@
|
|
1
|
-
.multi_value, .single_value {
|
2
|
-
.field-wrapper {
|
3
|
-
list-style-type:none;
|
4
|
-
}
|
5
|
-
|
6
|
-
.listing {
|
7
|
-
margin-left: 0;
|
8
|
-
max-width: 40em;
|
9
|
-
padding-left: 0px;
|
10
|
-
.input-group {
|
11
|
-
margin-bottom: 1px;
|
12
|
-
}
|
13
|
-
}
|
14
|
-
|
15
|
-
.field-controls span {
|
16
|
-
margin-left:.2em;
|
17
|
-
}
|
18
|
-
|
19
|
-
.field-controls {
|
20
|
-
margin-left: 2em;
|
21
|
-
}
|
22
|
-
|
23
|
-
.message{
|
24
|
-
background-size: 40px 40px;
|
25
|
-
background-image: linear-gradient(135deg, rgba(255, 255, 255, .05) 25%, transparent 25%,
|
26
|
-
transparent 50%, rgba(255, 255, 255, .05) 50%, rgba(255, 255, 255, .05) 75%,
|
27
|
-
transparent 75%, transparent);
|
28
|
-
box-shadow: inset 0 -1px 0 rgba(255,255,255,.4);
|
29
|
-
width: 100%;
|
30
|
-
border: 1px solid;
|
31
|
-
color: #fff;
|
32
|
-
padding: 10px;
|
33
|
-
text-shadow: 0 1px 0 rgba(0,0,0,.5);
|
34
|
-
animation: animate-bg 5s linear infinite;
|
35
|
-
border-radius: $border-radius-base;
|
36
|
-
}
|
37
|
-
|
38
|
-
.has-error{
|
39
|
-
background-color: #de4343;
|
40
|
-
border-color: #c43d3d;
|
41
|
-
}
|
42
|
-
|
43
|
-
.has-warning{
|
44
|
-
background-color: #eaaf51;
|
45
|
-
border-color: #d99a36;
|
46
|
-
}
|
47
|
-
}
|
48
|
-
|
49
|
-
// The contributor listing needs some normalization
|
50
|
-
#contributors .listing {
|
51
|
-
max-width:20em;
|
52
|
-
}
|
53
|
-
|
54
|
-
#collection_title.listing {
|
55
|
-
max-width:37em;
|
56
|
-
}
|
57
|
-
|
58
|
-
.collection_description .listing {
|
59
|
-
max-width:35.5em;
|
60
|
-
}
|
61
|
-
|
62
|
-
#descriptions_display {
|
63
|
-
.form-group, .batch-group {
|
64
|
-
margin-left: 0;
|
65
|
-
margin-bottom: 0.5em;
|
66
|
-
}
|
67
|
-
}
|
@@ -1,84 +0,0 @@
|
|
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
|
@@ -1 +0,0 @@
|
|
1
|
-
<%= render partial: "generic_files/rights_modal" %>
|
@@ -1,167 +0,0 @@
|
|
1
|
-
require 'simple_form'
|
2
|
-
# Use this setup block to configure all options available in SimpleForm.
|
3
|
-
SimpleForm.setup do |config|
|
4
|
-
# Wrappers are used by the form builder to generate a
|
5
|
-
# complete input. You can remove any component from the
|
6
|
-
# wrapper, change the order or even add your own to the
|
7
|
-
# stack. The options given below are used to wrap the
|
8
|
-
# whole input.
|
9
|
-
config.wrappers :default, class: :input,
|
10
|
-
hint_class: :field_with_hint, error_class: :field_with_errors do |b|
|
11
|
-
## Extensions enabled by default
|
12
|
-
# Any of these extensions can be disabled for a
|
13
|
-
# given input by passing: `f.input EXTENSION_NAME => false`.
|
14
|
-
# You can make any of these extensions optional by
|
15
|
-
# renaming `b.use` to `b.optional`.
|
16
|
-
|
17
|
-
# Determines whether to use HTML5 (:email, :url, ...)
|
18
|
-
# and required attributes
|
19
|
-
b.use :html5
|
20
|
-
|
21
|
-
# Calculates placeholders automatically from I18n
|
22
|
-
# You can also pass a string as f.input placeholder: "Placeholder"
|
23
|
-
b.use :placeholder
|
24
|
-
|
25
|
-
## Optional extensions
|
26
|
-
# They are disabled unless you pass `f.input EXTENSION_NAME => true`
|
27
|
-
# to the input. If so, they will retrieve the values from the model
|
28
|
-
# if any exists. If you want to enable any of those
|
29
|
-
# extensions by default, you can change `b.optional` to `b.use`.
|
30
|
-
|
31
|
-
# Calculates maxlength from length validations for string inputs
|
32
|
-
b.optional :maxlength
|
33
|
-
|
34
|
-
# Calculates pattern from format validations for string inputs
|
35
|
-
b.optional :pattern
|
36
|
-
|
37
|
-
# Calculates min and max from length validations for numeric inputs
|
38
|
-
b.optional :min_max
|
39
|
-
|
40
|
-
# Calculates readonly automatically from readonly attributes
|
41
|
-
b.optional :readonly
|
42
|
-
|
43
|
-
## Inputs
|
44
|
-
b.use :label_input
|
45
|
-
b.use :hint, wrap_with: { tag: :span, class: :hint }
|
46
|
-
b.use :error, wrap_with: { tag: :span, class: :error }
|
47
|
-
|
48
|
-
## full_messages_for
|
49
|
-
# If you want to display the full error message for the attribute, you can
|
50
|
-
# use the component :full_error, like:
|
51
|
-
#
|
52
|
-
# b.use :full_error, wrap_with: { tag: :span, class: :error }
|
53
|
-
end
|
54
|
-
|
55
|
-
# The default wrapper to be used by the FormBuilder.
|
56
|
-
config.default_wrapper = :default
|
57
|
-
|
58
|
-
# Define the way to render check boxes / radio buttons with labels.
|
59
|
-
# Defaults to :nested for bootstrap config.
|
60
|
-
# inline: input + label
|
61
|
-
# nested: label > input
|
62
|
-
config.boolean_style = :nested
|
63
|
-
|
64
|
-
# Default class for buttons
|
65
|
-
config.button_class = 'btn'
|
66
|
-
|
67
|
-
# Method used to tidy up errors. Specify any Rails Array method.
|
68
|
-
# :first lists the first message for each field.
|
69
|
-
# Use :to_sentence to list all errors for each field.
|
70
|
-
# config.error_method = :first
|
71
|
-
|
72
|
-
# Default tag used for error notification helper.
|
73
|
-
config.error_notification_tag = :div
|
74
|
-
|
75
|
-
# CSS class to add for error notification helper.
|
76
|
-
config.error_notification_class = 'error_notification'
|
77
|
-
|
78
|
-
# ID to add for error notification helper.
|
79
|
-
# config.error_notification_id = nil
|
80
|
-
|
81
|
-
# Series of attempts to detect a default label method for collection.
|
82
|
-
# config.collection_label_methods = [ :to_label, :name, :title, :to_s ]
|
83
|
-
|
84
|
-
# Series of attempts to detect a default value method for collection.
|
85
|
-
# config.collection_value_methods = [ :id, :to_s ]
|
86
|
-
|
87
|
-
# You can wrap a collection of radio/check boxes in a pre-defined tag, defaulting to none.
|
88
|
-
# config.collection_wrapper_tag = nil
|
89
|
-
|
90
|
-
# You can define the class to use on all collection wrappers. Defaulting to none.
|
91
|
-
# config.collection_wrapper_class = nil
|
92
|
-
|
93
|
-
# You can wrap each item in a collection of radio/check boxes with a tag,
|
94
|
-
# defaulting to :span. Please note that when using :boolean_style = :nested,
|
95
|
-
# SimpleForm will force this option to be a label.
|
96
|
-
# config.item_wrapper_tag = :span
|
97
|
-
|
98
|
-
# You can define a class to use in all item wrappers. Defaulting to none.
|
99
|
-
# config.item_wrapper_class = nil
|
100
|
-
|
101
|
-
# How the label text should be generated altogether with the required text.
|
102
|
-
# config.label_text = lambda { |label, required, explicit_label| "#{required} #{label}" }
|
103
|
-
|
104
|
-
# You can define the class to use on all labels. Default is nil.
|
105
|
-
# config.label_class = nil
|
106
|
-
|
107
|
-
# You can define the default class to be used on forms. Can be overriden
|
108
|
-
# with `html: { :class }`. Defaulting to none.
|
109
|
-
# config.default_form_class = nil
|
110
|
-
|
111
|
-
# You can define which elements should obtain additional classes
|
112
|
-
# config.generate_additional_classes_for = [:wrapper, :label, :input]
|
113
|
-
|
114
|
-
# Whether attributes are required by default (or not). Default is true.
|
115
|
-
# config.required_by_default = true
|
116
|
-
|
117
|
-
# Tell browsers whether to use the native HTML5 validations (novalidate form option).
|
118
|
-
# These validations are enabled in SimpleForm's internal config but disabled by default
|
119
|
-
# in this configuration, which is recommended due to some quirks from different browsers.
|
120
|
-
# To stop SimpleForm from generating the novalidate option, enabling the HTML5 validations,
|
121
|
-
# change this configuration to true.
|
122
|
-
config.browser_validations = false
|
123
|
-
|
124
|
-
# Collection of methods to detect if a file type was given.
|
125
|
-
# config.file_methods = [ :mounted_as, :file?, :public_filename ]
|
126
|
-
|
127
|
-
# Custom mappings for input types. This should be a hash containing a regexp
|
128
|
-
# to match as key, and the input type that will be used when the field name
|
129
|
-
# matches the regexp as value.
|
130
|
-
# config.input_mappings = { /count/ => :integer }
|
131
|
-
|
132
|
-
# Custom wrappers for input types. This should be a hash containing an input
|
133
|
-
# type as key and the wrapper that will be used for all inputs with specified type.
|
134
|
-
# config.wrapper_mappings = { string: :prepend }
|
135
|
-
|
136
|
-
# Namespaces where SimpleForm should look for custom input classes that
|
137
|
-
# override default inputs.
|
138
|
-
# config.custom_inputs_namespaces << "CustomInputs"
|
139
|
-
|
140
|
-
# Default priority for time_zone inputs.
|
141
|
-
# config.time_zone_priority = nil
|
142
|
-
|
143
|
-
# Default priority for country inputs.
|
144
|
-
# config.country_priority = nil
|
145
|
-
|
146
|
-
# When false, do not use translations for labels.
|
147
|
-
# config.translate_labels = true
|
148
|
-
|
149
|
-
# Automatically discover new inputs in Rails' autoload path.
|
150
|
-
# config.inputs_discovery = true
|
151
|
-
|
152
|
-
# Cache SimpleForm inputs discovery
|
153
|
-
# config.cache_discovery = !Rails.env.development?
|
154
|
-
|
155
|
-
# Default class for inputs
|
156
|
-
# config.input_class = nil
|
157
|
-
|
158
|
-
# Define the default class of the input wrapper of the boolean input.
|
159
|
-
config.boolean_label_class = 'checkbox'
|
160
|
-
|
161
|
-
# Defines if the default input wrapper class should be included in radio
|
162
|
-
# collection wrappers.
|
163
|
-
# config.include_default_input_wrapper_class = true
|
164
|
-
|
165
|
-
# Defines which i18n scope will be used in Simple Form.
|
166
|
-
# config.i18n_scope = 'simple_form'
|
167
|
-
end
|
@@ -1,137 +0,0 @@
|
|
1
|
-
require 'simple_form'
|
2
|
-
# Use this setup block to configure all options available in SimpleForm.
|
3
|
-
SimpleForm.setup do |config|
|
4
|
-
config.error_notification_class = 'alert alert-danger'
|
5
|
-
config.button_class = 'btn btn-default'
|
6
|
-
config.boolean_label_class = nil
|
7
|
-
|
8
|
-
config.wrappers :vertical_form, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
|
9
|
-
b.use :html5
|
10
|
-
b.use :placeholder
|
11
|
-
b.optional :maxlength
|
12
|
-
b.optional :pattern
|
13
|
-
b.optional :min_max
|
14
|
-
b.optional :readonly
|
15
|
-
b.use :label, class: 'control-label'
|
16
|
-
|
17
|
-
b.use :input, class: 'form-control'
|
18
|
-
b.use :error, wrap_with: { tag: 'span', class: 'help-block' }
|
19
|
-
b.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
|
20
|
-
end
|
21
|
-
|
22
|
-
config.wrappers :vertical_file_input, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
|
23
|
-
b.use :html5
|
24
|
-
b.use :placeholder
|
25
|
-
b.optional :maxlength
|
26
|
-
b.optional :readonly
|
27
|
-
b.use :label, class: 'control-label'
|
28
|
-
|
29
|
-
b.use :input
|
30
|
-
b.use :error, wrap_with: { tag: 'span', class: 'help-block' }
|
31
|
-
b.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
|
32
|
-
end
|
33
|
-
|
34
|
-
config.wrappers :vertical_boolean, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
|
35
|
-
b.use :html5
|
36
|
-
b.optional :readonly
|
37
|
-
|
38
|
-
b.wrapper tag: 'div', class: 'checkbox' do |ba|
|
39
|
-
ba.use :label_input
|
40
|
-
end
|
41
|
-
|
42
|
-
b.use :error, wrap_with: { tag: 'span', class: 'help-block' }
|
43
|
-
b.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
|
44
|
-
end
|
45
|
-
|
46
|
-
config.wrappers :vertical_radio_and_checkboxes, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
|
47
|
-
b.use :html5
|
48
|
-
b.optional :readonly
|
49
|
-
b.use :label, class: 'control-label'
|
50
|
-
b.use :input
|
51
|
-
b.use :error, wrap_with: { tag: 'span', class: 'help-block' }
|
52
|
-
b.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
|
53
|
-
end
|
54
|
-
|
55
|
-
config.wrappers :horizontal_form, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
|
56
|
-
b.use :html5
|
57
|
-
b.use :placeholder
|
58
|
-
b.optional :maxlength
|
59
|
-
b.optional :pattern
|
60
|
-
b.optional :min_max
|
61
|
-
b.optional :readonly
|
62
|
-
b.use :label, class: 'col-sm-3 control-label'
|
63
|
-
|
64
|
-
b.wrapper tag: 'div', class: 'col-sm-9' do |ba|
|
65
|
-
ba.use :input, class: 'form-control'
|
66
|
-
ba.use :error, wrap_with: { tag: 'span', class: 'help-block' }
|
67
|
-
ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
config.wrappers :horizontal_file_input, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
|
72
|
-
b.use :html5
|
73
|
-
b.use :placeholder
|
74
|
-
b.optional :maxlength
|
75
|
-
b.optional :readonly
|
76
|
-
b.use :label, class: 'col-sm-3 control-label'
|
77
|
-
|
78
|
-
b.wrapper tag: 'div', class: 'col-sm-9' do |ba|
|
79
|
-
ba.use :input
|
80
|
-
ba.use :error, wrap_with: { tag: 'span', class: 'help-block' }
|
81
|
-
ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
config.wrappers :horizontal_boolean, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
|
86
|
-
b.use :html5
|
87
|
-
b.optional :readonly
|
88
|
-
|
89
|
-
b.wrapper tag: 'div', class: 'col-sm-offset-3 col-sm-9' do |wr|
|
90
|
-
wr.wrapper tag: 'div', class: 'checkbox' do |ba|
|
91
|
-
ba.use :label_input, class: 'col-sm-9'
|
92
|
-
end
|
93
|
-
|
94
|
-
wr.use :error, wrap_with: { tag: 'span', class: 'help-block' }
|
95
|
-
wr.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
config.wrappers :horizontal_radio_and_checkboxes, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
|
100
|
-
b.use :html5
|
101
|
-
b.optional :readonly
|
102
|
-
|
103
|
-
b.use :label, class: 'col-sm-3 control-label'
|
104
|
-
|
105
|
-
b.wrapper tag: 'div', class: 'col-sm-9' do |ba|
|
106
|
-
ba.use :input
|
107
|
-
ba.use :error, wrap_with: { tag: 'span', class: 'help-block' }
|
108
|
-
ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
|
-
config.wrappers :inline_form, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
|
113
|
-
b.use :html5
|
114
|
-
b.use :placeholder
|
115
|
-
b.optional :maxlength
|
116
|
-
b.optional :pattern
|
117
|
-
b.optional :min_max
|
118
|
-
b.optional :readonly
|
119
|
-
b.use :label, class: 'sr-only'
|
120
|
-
|
121
|
-
b.use :input, class: 'form-control'
|
122
|
-
b.use :error, wrap_with: { tag: 'span', class: 'help-block' }
|
123
|
-
b.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
|
124
|
-
end
|
125
|
-
|
126
|
-
# Wrappers for forms and inputs using the Bootstrap toolkit.
|
127
|
-
# Check the Bootstrap docs (http://getbootstrap.com)
|
128
|
-
# to learn about the different styles for forms and inputs,
|
129
|
-
# buttons and other elements.
|
130
|
-
config.default_wrapper = :vertical_form
|
131
|
-
config.wrapper_mappings = {
|
132
|
-
check_boxes: :vertical_radio_and_checkboxes,
|
133
|
-
radio_buttons: :vertical_radio_and_checkboxes,
|
134
|
-
file: :vertical_file_input,
|
135
|
-
boolean: :vertical_boolean,
|
136
|
-
}
|
137
|
-
end
|