-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #66 from Floppy/style-forms
Better styling for the various forms
- Loading branch information
Showing
19 changed files
with
183 additions
and
141 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
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 |
---|---|---|
|
@@ -32,5 +32,6 @@ def get_library | |
|
||
def get_model | ||
@model = @library.models.find(params[:id]) | ||
@title = @model.name | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,5 +36,6 @@ def get_model | |
|
||
def get_part | ||
@part = @model.parts.find(params[:id]) | ||
@title = @part.name | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
<div class='nested-fields'> | ||
<div class="field"> | ||
<%= f.label :url %> | ||
<%= f.url_field :url %> | ||
<%= link_to_remove_association "remove", f %> | ||
</div> | ||
<div class="row mb-3 input-group nested-fields"> | ||
<%= f.label :url, class: "col-sm-2 col-form-label" %> | ||
<%= f.url_field :url, class: "form-control col-auto", placeholder: "Any related web page" %> | ||
<%= link_to_remove_association icon(:trash, "Delete"), f, class: "btn btn-outline-danger col-auto" %> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<fieldset id='links'> | ||
<%= form.fields_for :links do |f| %> | ||
<%= render 'link_fields', :f => f %> | ||
<% end %> | ||
<div class="row mb-3"> | ||
<%= tag.div class: "col-auto offset-sm-2 ps-0" do %> | ||
<%= link_to_add_association 'add another link', form, :links, class: "btn btn-secondary" %> | ||
<% end %> | ||
</div> | ||
</fieldset> |
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 |
---|---|---|
@@ -1,4 +1,3 @@ | ||
<h1>Edit Creator</h1> | ||
|
||
<%= render 'form' %> | ||
<%= link_to 'Delete', @creator, method: :delete, data: {confirm: "Are you sure?"}, class: "btn btn-danger" %> |
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 |
---|---|---|
@@ -1,7 +1,16 @@ | ||
<h1>Creators</h1> | ||
|
||
<div class="row row-cols-2 row-cols-md-4 mb-4"> | ||
<%= render @creators %> | ||
</div> | ||
<div class="row row-cols-2"> | ||
<div class="col-9"> | ||
<div class="row row-cols-2 row-cols-md-3 mb-3"> | ||
<%= render @creators %> | ||
</div> | ||
</div> | ||
<div class="col-3"> | ||
|
||
<%= card :secondary, "Actions" do %> | ||
<%= link_to "New Creator", new_creator_path, class: "btn btn-primary" %> | ||
<% end %> | ||
|
||
<%= link_to "New", new_creator_path %> | ||
</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
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 |
---|---|---|
@@ -1,25 +1,26 @@ | ||
<%= link_to "Rescan", library_path(@library), method: :patch, class: 'float-end btn btn-warning' %> | ||
<h1><%= @library.name %></h1> | ||
<div class="row row-cols-2"> | ||
<div class="col-9"> | ||
<div class="row row-cols-2 row-cols-md-3 mb-3"> | ||
<div class="row row-cols-2 row-cols-md-3 mb-4"> | ||
<%= render partial: 'model', collection: @models %> | ||
</div> | ||
</div> | ||
<div class="col-3"> | ||
<div class="card mb-4"> | ||
<div class="card-header text-white bg-secondary">Tags</div> | ||
<div class="card-body"> | ||
<div class="card-text"> | ||
<% @tags.each do |tag| %> | ||
<% if (tag == @tag) %> | ||
<%=link_to tag.name, @library, {class: "badge rounded-pill bg-success"} %> | ||
<% else %> | ||
<%=link_to tag.name, [@library, tag: tag.name], {class: "badge rounded-pill bg-secondary"} %> | ||
<% end %> | ||
<% end %> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<%= card :secondary, "Tags" do %> | ||
<% @tags.each do |tag| %> | ||
<% if (tag == @tag) %> | ||
<%=link_to tag.name, @library, {class: "badge rounded-pill bg-success"} %> | ||
<% else %> | ||
<%=link_to tag.name, [@library, tag: tag.name], {class: "badge rounded-pill bg-secondary"} %> | ||
<% end %> | ||
<% end %> | ||
<% end %> | ||
<%= card :secondary, "Actions" do %> | ||
<%= link_to "Rescan", library_path(@library), method: :patch, class: 'btn btn-warning' %> | ||
<%= link_to "New Library", new_library_path, class: 'btn btn-secondary' %> | ||
<% end %> | ||
|
||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,26 @@ | ||
<%= form_with model: [@library, @model] do |form| %> | ||
<form> | ||
<div class="mb-3"> | ||
<%= form.label :name %> | ||
<%= form.text_field :name %> | ||
</div> | ||
<div class="mb-3"> | ||
<%= form.label :preview_part %> | ||
<%= form.collection_select :preview_part_id, @model.parts, :id, :name, include_blank: true %> | ||
</div> | ||
<div class="mb-3"> | ||
<%= form.label :creator %> | ||
<%= form.collection_select :creator_id, @creators, :id, :name, include_blank: true %> | ||
<div class="row mb-3 input-group"> | ||
<%= form.label :name, class: "col-sm-2 col-form-label" %> | ||
<%= form.text_field :name, class: "form-control col-auto" %> | ||
</div> | ||
|
||
<h3>Links</h3> | ||
<div id='links'> | ||
<%= form.fields_for :links do |link| %> | ||
<%= render 'link_fields', :f => link %> | ||
<% end %> | ||
<div class='links'> | ||
<%= link_to_add_association 'add link', form, :links %> | ||
<div class="row mb-3 input-group"> | ||
<%= form.label :preview_part, class: "col-sm-2 col-form-label" %> | ||
<div class='col-sm-10 ps-0'> | ||
<%= form.collection_select :preview_part_id, @model.parts, :id, :name, {}, {class: "form-control form-select"} %> | ||
<span id="previewPartHelp" class="form-text">The part displayed as a model preview in library pages</span> | ||
</div> | ||
</div> | ||
|
||
<div class="row mb-3 input-group"> | ||
<%= form.label :creator_id, class: "col-sm-2 col-form-label" %> | ||
<%= form.collection_select :creator_id, @creators, :id, :name, {include_blank: true}, {class: "form-control col-auto form-select"} %> | ||
<%= link_to "New Creator", new_creator_path, class: "btn btn-outline-secondary col-auto" %> | ||
</div> | ||
|
||
<%= render 'links_form', :form => form %> | ||
<%= form.submit "Save", class: "btn btn-primary" %> | ||
</form> | ||
<% end %> |
Oops, something went wrong.