sufia 6.0.0.rc2 → 6.0.0.rc3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (198) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +5 -5
  3. data/History.md +14 -0
  4. data/LICENSE +15 -0
  5. data/SUFIA_VERSION +1 -1
  6. data/app/assets/javascripts/sufia/batch_edit.js +1 -1
  7. data/app/assets/javascripts/sufia/permissions.js +8 -12
  8. data/app/assets/stylesheets/sufia.css.scss +1 -1
  9. data/app/assets/stylesheets/sufia/_multi_value_fields.css.scss +67 -0
  10. data/app/assets/stylesheets/sufia/_settings.scss +1 -0
  11. data/app/assets/stylesheets/sufia/_styles.scss +4 -0
  12. data/app/assets/stylesheets/sufia/_tinymce.scss +14 -0
  13. data/app/controllers/batch_controller.rb +11 -2
  14. data/app/controllers/concerns/sufia/breadcrumbs.rb +2 -3
  15. data/app/controllers/concerns/sufia/collections_controller_behavior.rb +0 -1
  16. data/app/controllers/concerns/sufia/contact_form_controller_behavior.rb +1 -2
  17. data/app/controllers/concerns/sufia/controller.rb +1 -7
  18. data/app/controllers/concerns/sufia/downloads_controller_behavior.rb +3 -8
  19. data/app/controllers/concerns/sufia/files_controller/local_ingest_behavior.rb +2 -3
  20. data/app/controllers/concerns/sufia/files_controller/upload_complete_behavior.rb +1 -2
  21. data/app/controllers/concerns/sufia/files_controller_behavior.rb +27 -14
  22. data/app/controllers/concerns/sufia/homepage_controller.rb +3 -2
  23. data/app/controllers/content_blocks_controller.rb +17 -1
  24. data/app/controllers/downloads_controller.rb +0 -1
  25. data/app/controllers/my/shares_controller.rb +1 -0
  26. data/app/controllers/single_use_links_controller.rb +0 -1
  27. data/app/controllers/single_use_links_viewer_controller.rb +3 -8
  28. data/app/forms/sufia/forms/generic_file_edit_form.rb +1 -8
  29. data/app/helpers/content_block_helper.rb +30 -10
  30. data/app/helpers/generic_file_helper.rb +4 -4
  31. data/app/helpers/sufia/dashboard_helper_behavior.rb +2 -2
  32. data/app/helpers/sufia/sufia_helper_behavior.rb +4 -4
  33. data/app/helpers/trophy_helper.rb +3 -3
  34. data/app/jobs/content_delete_event_job.rb +1 -2
  35. data/app/jobs/content_deposit_event_job.rb +1 -1
  36. data/app/jobs/content_depositor_change_event_job.rb +1 -1
  37. data/app/jobs/content_new_version_event_job.rb +1 -1
  38. data/app/jobs/content_restored_version_event_job.rb +1 -1
  39. data/app/jobs/content_update_event_job.rb +1 -1
  40. data/app/models/concerns/sufia/solr_document_behavior.rb +5 -9
  41. data/app/models/content_block.rb +20 -0
  42. data/app/models/featured_work_list.rb +4 -0
  43. data/app/presenters/sufia/collection_presenter.rb +14 -2
  44. data/app/presenters/sufia/generic_file_presenter.rb +16 -0
  45. data/app/presenters/sufia/version_list_presenter.rb +1 -1
  46. data/app/views/batch/_metadata.html.erb +4 -4
  47. data/app/views/batch_edits/edit.html.erb +1 -1
  48. data/app/views/collections/_action_menu.html.erb +4 -5
  49. data/app/views/collections/_show_descriptions.html.erb +1 -5
  50. data/app/views/collections/_show_document_list.html.erb +0 -2
  51. data/app/views/collections/_show_document_list_menu.html.erb +5 -6
  52. data/app/views/collections/_show_document_list_row.html.erb +9 -9
  53. data/app/views/collections/_sort_and_per_page.html.erb +1 -1
  54. data/app/views/collections/_view_type_group.html.erb +1 -1
  55. data/app/views/collections/show.html.erb +3 -3
  56. data/app/views/generic_files/_asset_permissions_denial_flash.html.erb +1 -1
  57. data/app/views/generic_files/_asset_saved_flash.html.erb +1 -1
  58. data/app/views/generic_files/_asset_updated_flash.html.erb +1 -1
  59. data/app/views/generic_files/_browse_everything.html.erb +4 -4
  60. data/app/views/generic_files/_media_display.html.erb +9 -9
  61. data/app/views/generic_files/_permission_form.html.erb +1 -1
  62. data/app/views/generic_files/_show_actions.html.erb +1 -1
  63. data/app/views/generic_files/_show_collections.html.erb +2 -2
  64. data/app/views/generic_files/_show_details.html.erb +1 -1
  65. data/app/views/generic_files/_versioning.html.erb +9 -5
  66. data/app/views/generic_files/jq_upload.json.jbuilder +1 -1
  67. data/app/views/generic_files/new.html.erb +2 -3
  68. data/app/views/generic_files/show.html.erb +13 -16
  69. data/app/views/generic_files/upload/_alerts.html.erb +2 -2
  70. data/app/views/generic_files/upload/_form_fields.html.erb +1 -1
  71. data/app/views/generic_files/upload/_local_file_import_chooser.html.erb +1 -1
  72. data/app/views/generic_files/upload/_script_templates.html.erb +2 -2
  73. data/app/views/homepage/_featured.html.erb +2 -4
  74. data/app/views/homepage/_featured_researcher.html.erb +1 -1
  75. data/app/views/homepage/_featured_works.html.erb +5 -3
  76. data/app/views/homepage/_home_content.html.erb +1 -1
  77. data/app/views/homepage/_recent_document.html.erb +2 -2
  78. data/app/views/homepage/_sortable_featured.html.erb +1 -2
  79. data/app/views/my/_action_menu.html.erb +8 -8
  80. data/app/views/my/_collection_action_menu.html.erb +4 -4
  81. data/app/views/my/_index_partials/_list_collections.html.erb +9 -12
  82. data/app/views/my/_index_partials/_list_files.html.erb +9 -9
  83. data/app/views/my/index.html.erb +0 -1
  84. data/app/views/records/_rights_modal.html.erb +1 -0
  85. data/app/views/users/_contributions.html.erb +2 -3
  86. data/app/views/users/_edit_primary.html.erb +68 -0
  87. data/app/views/users/_edit_secondary.html.erb +1 -0
  88. data/app/views/users/_trophy_edit.html.erb +1 -3
  89. data/app/views/users/edit.html.erb +4 -78
  90. data/config/initializers/simple_form.rb +167 -0
  91. data/config/initializers/simple_form_bootstrap.rb +137 -0
  92. data/config/locales/simple_form.en.yml +31 -0
  93. data/config/locales/sufia.en.yml +7 -4
  94. data/config/routes.rb +1 -1
  95. data/lib/generators/sufia/templates/catalog_controller.rb +1 -1
  96. data/lib/sufia/single_use_error.rb +1 -1
  97. data/lib/sufia/version.rb +1 -1
  98. data/spec/actors/generic_file/actor_spec.rb +5 -5
  99. data/spec/controllers/batch_controller_spec.rb +15 -0
  100. data/spec/controllers/collections_controller_spec.rb +1 -1
  101. data/spec/controllers/content_blocks_controller_spec.rb +23 -3
  102. data/spec/controllers/downloads_controller_spec.rb +5 -5
  103. data/spec/controllers/generic_files_controller_spec.rb +12 -12
  104. data/spec/controllers/homepage_controller_spec.rb +19 -6
  105. data/spec/controllers/my/files_controller_spec.rb +8 -10
  106. data/spec/controllers/my/shares_controller_spec.rb +34 -23
  107. data/spec/controllers/single_use_links_controller_spec.rb +2 -3
  108. data/spec/controllers/single_use_links_viewer_controller_spec.rb +19 -20
  109. data/spec/controllers/users_controller_spec.rb +8 -8
  110. data/spec/factories/generic_files.rb +4 -4
  111. data/spec/factories/users.rb +2 -3
  112. data/spec/features/browse_dashboard_files_spec.rb +8 -8
  113. data/spec/features/collection_spec.rb +15 -8
  114. data/spec/features/edit_file_spec.rb +26 -0
  115. data/spec/features/single_use_links_spec.rb +3 -3
  116. data/spec/forms/generic_file_edit_form_spec.rb +8 -1
  117. data/spec/helpers/content_block_helper_spec.rb +10 -0
  118. data/spec/helpers/dashboard_helper_spec.rb +42 -0
  119. data/spec/helpers/sufia_helper_spec.rb +34 -7
  120. data/spec/helpers/trophy_helper_spec.rb +6 -6
  121. data/spec/inputs/select_with_help_input_spec.rb +16 -0
  122. data/spec/jobs/audit_job_spec.rb +1 -1
  123. data/spec/jobs/characterize_job_spec.rb +2 -7
  124. data/spec/jobs/create_derivatives_job_spec.rb +27 -38
  125. data/spec/jobs/import_url_job_spec.rb +2 -2
  126. data/spec/jobs/ingest_local_file_job_spec.rb +6 -8
  127. data/spec/lib/sufia/id_service_spec.rb +0 -7
  128. data/spec/lib/sufia/messages_spec.rb +16 -13
  129. data/spec/models/ability_spec.rb +3 -0
  130. data/spec/models/checksum_audit_log_spec.rb +1 -1
  131. data/spec/models/content_block_spec.rb +41 -0
  132. data/spec/models/featured_work_list_spec.rb +23 -9
  133. data/spec/models/file_content_datastream_spec.rb +4 -4
  134. data/spec/models/file_usage_spec.rb +1 -1
  135. data/spec/models/fits_datastream_spec.rb +4 -4
  136. data/spec/models/generic_file_spec.rb +31 -15
  137. data/spec/models/single_use_link_spec.rb +2 -2
  138. data/spec/models/solr_document_spec.rb +8 -5
  139. data/spec/models/user_spec.rb +3 -3
  140. data/spec/presenters/sufia/collection_presenter_spec.rb +34 -0
  141. data/spec/presenters/sufia/generic_file_presenter_spec.rb +41 -1
  142. data/spec/presenters/sufia/version_list_presenter_spec.rb +12 -2
  143. data/spec/services/generic_file_audit_service_spec.rb +3 -3
  144. data/spec/services/noid_spec.rb +4 -11
  145. data/spec/services/repository_audit_service_spec.rb +1 -1
  146. data/spec/spec_helper.rb +1 -0
  147. data/spec/support/fixture_helpers.rb +2 -3
  148. data/spec/support/selectors.rb +7 -7
  149. data/spec/test_app_templates/Gemfile.extra +1 -0
  150. data/spec/views/batch/edit.html.erb_spec.rb +14 -17
  151. data/spec/views/collections/_show_descriptions.html.erb_spec.rb +1 -1
  152. data/spec/views/generic_file/_permission_form.html.erb_spec.rb +29 -7
  153. data/spec/views/generic_file/edit.html.erb_spec.rb +1 -1
  154. data/spec/views/generic_file/show.html.erb_spec.rb +69 -151
  155. data/spec/views/generic_file/stats.html.erb_spec.rb +1 -1
  156. data/spec/views/homepage/_featured_works.html.erb_spec.rb +29 -0
  157. data/spec/views/users/show.html.erb_spec.rb +1 -1
  158. data/sufia-models/app/actors/sufia/generic_file/actor.rb +12 -8
  159. data/sufia-models/app/jobs/batch_update_job.rb +2 -2
  160. data/sufia-models/app/jobs/import_url_job.rb +5 -3
  161. data/sufia-models/app/jobs/ingest_local_file_job.rb +46 -0
  162. data/sufia-models/app/jobs/resolrize_job.rb +1 -8
  163. data/sufia-models/app/models/batch.rb +0 -7
  164. data/sufia-models/app/models/concerns/sufia/ability.rb +1 -1
  165. data/sufia-models/app/models/concerns/sufia/{collection.rb → collection_behavior.rb} +1 -13
  166. data/sufia-models/app/models/concerns/sufia/generic_file/batches.rb +3 -4
  167. data/sufia-models/app/models/concerns/sufia/generic_file/export.rb +1 -1
  168. data/sufia-models/app/models/concerns/sufia/generic_file/featured.rb +1 -4
  169. data/sufia-models/app/models/concerns/sufia/generic_file/metadata.rb +7 -7
  170. data/sufia-models/app/models/concerns/sufia/generic_file/trophies.rb +1 -2
  171. data/sufia-models/app/models/concerns/sufia/generic_file/virus_check.rb +16 -11
  172. data/sufia-models/app/models/concerns/sufia/model_methods.rb +1 -14
  173. data/sufia-models/app/models/concerns/sufia/user.rb +5 -0
  174. data/sufia-models/app/models/file_usage.rb +1 -1
  175. data/sufia-models/app/models/file_view_stat.rb +1 -1
  176. data/sufia-models/app/models/sufia/collection.rb +5 -0
  177. data/sufia-models/app/services/sufia/generic_file_indexing_service.rb +1 -1
  178. data/sufia-models/app/services/sufia/id_service.rb +1 -2
  179. data/sufia-models/app/services/sufia/noid.rb +4 -24
  180. data/sufia-models/lib/generators/sufia/models/install_generator.rb +6 -1
  181. data/sufia-models/lib/generators/sufia/models/templates/app/models/collection.rb +2 -0
  182. data/sufia-models/lib/generators/sufia/models/templates/config/resque_config.rb +1 -1
  183. data/sufia-models/lib/generators/sufia/models/templates/config/solrconfig.xml +46 -0
  184. data/sufia-models/lib/generators/sufia/models/templates/config/sufia.rb +9 -5
  185. data/sufia-models/lib/generators/sufia/models/templates/migrations/add_external_key_to_content_blocks.rb +6 -0
  186. data/sufia-models/lib/generators/sufia/models/update_content_blocks_generator.rb +18 -0
  187. data/sufia-models/lib/sufia/messages.rb +11 -12
  188. data/sufia-models/lib/sufia/models/engine.rb +2 -1
  189. data/sufia-models/lib/sufia/models/stats/user_stat_importer.rb +9 -5
  190. data/sufia-models/lib/sufia/models/version.rb +1 -1
  191. data/sufia-models/sufia-models.gemspec +5 -5
  192. data/sufia.gemspec +15 -15
  193. data/tasks/sufia-dev.rake +0 -16
  194. metadata +86 -64
  195. data/LICENSE.md +0 -14
  196. data/app/jobs/ingest_local_file_job.rb +0 -39
  197. data/sufia-models/app/models/collection.rb +0 -3
  198. data/sufia-models/app/services/sufia/indexing_service.rb +0 -15
@@ -0,0 +1,167 @@
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 = true
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
@@ -0,0 +1,137 @@
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
@@ -0,0 +1,31 @@
1
+ en:
2
+ simple_form:
3
+ "yes": 'Yes'
4
+ "no": 'No'
5
+ required:
6
+ text: 'required'
7
+ mark: '*'
8
+ # You can uncomment the line below if you need to overwrite the whole required html.
9
+ # When using html, text and mark won't be used.
10
+ # html: '<abbr title="required">*</abbr>'
11
+ error_notification:
12
+ default_message: "Please review the problems below:"
13
+ # Examples
14
+ # labels:
15
+ # defaults:
16
+ # password: 'Password'
17
+ # user:
18
+ # new:
19
+ # email: 'E-mail to sign in.'
20
+ # edit:
21
+ # email: 'E-mail.'
22
+ # hints:
23
+ # defaults:
24
+ # username: 'User name to sign in.'
25
+ # password: 'No special characters, please.'
26
+ # include_blanks:
27
+ # defaults:
28
+ # age: 'Rather not say'
29
+ # prompts:
30
+ # defaults:
31
+ # age: 'Select your age'
@@ -1,6 +1,7 @@
1
1
  en:
2
2
  sufia:
3
3
  account_name: "My Institution Account Id"
4
+ account_label: "User"
4
5
  deposit_agreement: "Sufia's Deposit Agreement"
5
6
  document_language: "en"
6
7
  upload_tooltip: "Please accept Deposit Agreement before you can upload."
@@ -46,11 +47,11 @@ en:
46
47
  local_ingest:
47
48
  tab_label: "Network/Server Location"
48
49
  processing: "File is being processed; you may edit when processing has completed"
49
- field_label:
50
- total_items: "Total Items"
51
- size: "Size"
52
50
  homepage:
53
- featured_works: 'Featured Works'
51
+ featured_works:
52
+ tab_label: 'Featured Works'
53
+ title: 'Featured Works'
54
+ no_works: 'No works have been featured'
54
55
  recently_uploaded: 'Recently Uploaded'
55
56
  explore: 'Explore'
56
57
  sr_explore: 'Popular Keywords'
@@ -167,6 +168,8 @@ en:
167
168
  tag: "Keyword"
168
169
  date_created: "Date Created"
169
170
  related_url: "Related URL"
171
+ total_items: "Total Items"
172
+ size: "Size"
170
173
 
171
174
  metadata_help:
172
175
  generic_file:
@@ -117,7 +117,7 @@ Sufia::Engine.routes.draw do
117
117
  end
118
118
  end
119
119
 
120
- resources :content_blocks, only: 'update'
120
+ resources :content_blocks, only: ['create', 'update']
121
121
  post '/tinymce_assets' => 'tinymce_assets#create'
122
122
 
123
123
  get 'about' => 'pages#show', id: 'about_page'
@@ -124,7 +124,7 @@ class CatalogController < ApplicationController
124
124
  all_names = config.show_fields.values.map{|val| val.field}.join(" ")
125
125
  title_name = solr_name("title", :stored_searchable)
126
126
  field.solr_parameters = {
127
- qf: "#{all_names} noid_tsi file_format_tesim all_text_timv",
127
+ qf: "#{all_names} file_format_tesim all_text_timv",
128
128
  pf: "#{title_name}"
129
129
  }
130
130
  end
@@ -1,4 +1,4 @@
1
- module Sufia
1
+ module Sufia
2
2
  class SingleUseError < StandardError; end
3
3
  end
4
4
 
@@ -1,3 +1,3 @@
1
1
  module Sufia
2
- VERSION = "6.0.0.rc2"
2
+ VERSION = "6.0.0.rc3"
3
3
  end
@@ -17,7 +17,7 @@ describe Sufia::GenericFile::Actor do
17
17
  allow(CharacterizeJob).to receive(:new).with(generic_file.id).and_return(characterize_message)
18
18
  expect(Sufia.queue).to receive(:push).with(deposit_message)
19
19
  expect(Sufia.queue).to receive(:push).with(characterize_message)
20
- actor.create_content(uploaded_file, 'world.png', 'content')
20
+ actor.create_content(uploaded_file, 'world.png', 'content', 'image/png')
21
21
  end
22
22
 
23
23
  context "with two existing versions from different users" do
@@ -32,8 +32,8 @@ describe Sufia::GenericFile::Actor do
32
32
 
33
33
  before do
34
34
  allow(Sufia.queue).to receive(:push)
35
- actor1.create_content(fixture_file_upload(file1), file1, 'content')
36
- actor2.create_content(fixture_file_upload(file2), file2, 'content')
35
+ actor1.create_content(fixture_file_upload(file1), file1, 'content', 'image/png')
36
+ actor2.create_content(fixture_file_upload(file2), file2, 'content', 'image/jpeg')
37
37
  end
38
38
 
39
39
  it "should have two versions" do
@@ -69,7 +69,7 @@ describe Sufia::GenericFile::Actor do
69
69
  let(:gf) { FactoryGirl.create(:generic_file, visibility: 'open') }
70
70
  let(:actor) { Sufia::GenericFile::Actor.new(gf, user)}
71
71
 
72
- before { FeaturedWork.create(generic_file_id: gf.noid) }
72
+ before { FeaturedWork.create(generic_file_id: gf.id) }
73
73
 
74
74
  it "should be removed if document is not public" do
75
75
  # Switch document from public to restricted
@@ -90,7 +90,7 @@ describe Sufia::GenericFile::Actor do
90
90
 
91
91
  before do
92
92
  allow(actor).to receive(:save_characterize_and_record_committer).and_return("true")
93
- actor.create_content(Tempfile.new(new_file), new_file, "content")
93
+ actor.create_content(Tempfile.new(new_file), new_file, "content", 'image/jpg')
94
94
  end
95
95
 
96
96
  it "will retain the object's original label" do
@@ -22,6 +22,21 @@ describe BatchController do
22
22
  end
23
23
  end
24
24
 
25
+ describe "when submiting files on behalf of another user" do
26
+ let(:somebody_else_file) do
27
+ f = GenericFile.create(title: ['Original Title']) { |gf| gf.apply_depositor_metadata('current_user') }
28
+ f.on_behalf_of = 'somebody@else.org'
29
+ f.save!
30
+ f
31
+ end
32
+ let(:batch) { Batch.create { |b| b.generic_files.push(somebody_else_file) } }
33
+ it "should go to my shares page" do
34
+ post :update, id: batch, "generic_file"=>{"permissions_attributes"=>[{"type" => "group", "name" => "public", "access" => "read"}]}
35
+ expect(response).to redirect_to routes.url_helpers.dashboard_shares_path
36
+ end
37
+ end
38
+
39
+
25
40
  describe "when user has edit permissions on a file" do
26
41
  # TODO all these tests could move to batch_update_job_spec.rb
27
42
  let!(:file) { GenericFile.create(batch: batch) { |f| f.apply_depositor_metadata(user) } }