-
Notifications
You must be signed in to change notification settings - Fork 226
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
support for new container model in RDE
- Loading branch information
Showing
12 changed files
with
151 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
common/db/migrations/086_add_created_for_collection_to_top_container.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
Sequel.migration do | ||
|
||
up do | ||
alter_table(:top_container) do | ||
add_column(:created_for_collection, String, :null => true) | ||
end | ||
end | ||
|
||
|
||
down do | ||
# no going back | ||
end | ||
|
||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<%= render_aspace_partial :partial => "shared/form_messages", :locals => {:object => @top_container, :form => form} %> | ||
<% define_template("top_container", jsonmodel_definition(:top_container)) do |form| %> | ||
<%= form.label_and_select "type", form.possible_options_for('type', true) %> | ||
<%= form.label_and_textfield("indicator") %> | ||
<%= form.label_and_textfield("barcode") %> | ||
<%= form.hidden_input("created_for_collection", created_for_collection) %> | ||
<% end %> | ||
<% form.emit_template("top_container") %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<% | ||
if form.obj['ref'].blank? | ||
selected_json = "{}" | ||
else | ||
selected_json = form.obj['_resolved'].to_json | ||
end | ||
|
||
exclude_ids = [] if exclude_ids.blank? | ||
|
||
allow_create = true if allow_create.nil? | ||
|
||
required = true if required.nil? | ||
|
||
linkable_types = ["top_container"] | ||
|
||
build_typeahead_url = proc { | ||
uri = self.instance_variable_get(:"@resource_uri") | ||
|
||
url_for :controller => :top_containers, :action => :typeahead, :format => :json, :uri => uri | ||
} | ||
|
||
%> | ||
<div class="form-group <% if required %>required<% end %>"> | ||
<div class="controls col-sm-10"> | ||
<div class="input-group linker-wrapper"> | ||
<input type="text" class="linker" | ||
id="<%= form.id_for("ref") %>" | ||
data-label="<%= I18n.t("top_container._singular") %>" | ||
data-label_plural="<%= I18n.t("top_container._plural") %>" | ||
data-name="ref" | ||
data-path="<%= form.path %>" | ||
data-url="<%= build_typeahead_url.call %>" | ||
data-browse-url="<%= url_for :controller => :top_containers, :action => :bulk_operations_browse %>" | ||
data-selected="<%= selected_json %>" | ||
data-multiplicity="one" | ||
data-types='<%= linkable_types.to_json %>' | ||
data-exclude='<%= exclude_ids.to_json %>' | ||
/> | ||
|
||
<% if form.obj.has_key?('_resolved') %> | ||
|
||
<input type="text" | ||
class='prelinker' | ||
name="<%= form.path %>[_resolved]" | ||
value="<%= selected_json %>" /> | ||
|
||
<input type="text" | ||
class='prelinker' | ||
name="<%= form.path %>[ref]" | ||
value="<%= form.obj["ref"] %>" /> | ||
|
||
<% end %> | ||
<% if allow_create && user_can?('update_container_record') %> | ||
|
||
<div class="input-group-btn"> | ||
<a data-target="<%= url_for :controller => :top_containers, :action => :new, :small => true, :inline => true, :created_for_collection => self.instance_variable_get(:"@resource_uri") %>" class="btn btn-default linker-create-btn"><%= I18n.t("actions.create") %></a> | ||
</div> | ||
|
||
<% end %> | ||
</div> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters