-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add basic implementation of general edit form
- Loading branch information
1 parent
0e0032e
commit d2b91fa
Showing
11 changed files
with
136 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
.translation-subheading { | ||
border-bottom: 1px solid $navbar-default-border; | ||
margin-bottom: 20px; | ||
} | ||
|
||
.form-group.translation-form { | ||
.control-label { | ||
padding-top: $panel-body-padding + $padding-base-vertical; | ||
} | ||
|
||
.glyphicon-ok { | ||
color: $translation-available-color; | ||
padding-top: $panel-body-padding + $padding-base-vertical; | ||
} | ||
} | ||
|
||
.panel-translation { | ||
background-color: $translation-panel-bg; | ||
padding-bottom: 0; | ||
|
||
.help-block { | ||
color: $translation-help-color; | ||
padding-left: 12px; | ||
} | ||
} |
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,3 @@ | ||
.inline-block { | ||
display: inline-block; | ||
} |
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,16 @@ | ||
module Spotlight | ||
## | ||
# Base CRUD controller for translations | ||
class TranslationsController < Spotlight::ApplicationController | ||
before_action :authenticate_user!, :set_language | ||
load_and_authorize_resource :exhibit, class: Spotlight::Exhibit | ||
|
||
def index; end | ||
|
||
private | ||
|
||
def set_language | ||
@language = params[:language] || current_exhibit.available_locales.first | ||
end | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<%= render 'spotlight/shared/exhibit_sidebar' %> | ||
|
||
<div class='col-md-9 translation-edit-form'> | ||
<%= curation_page_title 'Translations' %> | ||
|
||
<div class='text-center'> | ||
<ul class='nav nav-pills inline-block'> | ||
<% current_exhibit.available_locales.each do |language| %> | ||
<li role="presentation" class="<%= 'active' if @language == language %>"> | ||
<%= link_to spotlight.exhibit_translations_path(current_exhibit, language: language) do %> | ||
<%= t("locales.#{language.downcase}") %> | ||
<% end %> | ||
</li> | ||
<% end %> | ||
</ul> | ||
</div> | ||
|
||
<ul class='nav nav-tabs'> | ||
<li> | ||
<a href='#'>General</a> | ||
</li> | ||
</ul> | ||
|
||
<h2 class='translation-subheading'> | ||
Basic Settings | ||
</h2> | ||
|
||
<%= bootstrap_form_for current_exhibit, layout: :horizontal do |f| %> | ||
<% translation = Translation.find_or_initialize_by(exhibit: current_exhibit, key: "#{current_exhibit.slug}.title", locale: @language) %> | ||
<%= f.fields_for :translations, translation do |translation_fields| %> | ||
<%= translation_fields.hidden_field :key %> | ||
<%= translation_fields.hidden_field :locale %> | ||
<div class='form-group translation-form'> | ||
<%= translation_fields.label :value, 'Title', class: 'control-label col-sm-2' %> | ||
<div class='col-md-8 panel panel-body panel-translation'> | ||
<%= translation_fields.text_field_without_bootstrap :value, class: 'form-control' %> | ||
<p class="help-block"> | ||
<%= current_exhibit.title %> | ||
</p> | ||
</div> | ||
<div class='col-md-2'> | ||
<% if translation.value.present? %> | ||
<span class='glyphicon glyphicon-ok'></span> | ||
<% end %> | ||
</div> | ||
</div> | ||
<% end %> | ||
<% translation = Translation.find_or_initialize_by(exhibit: current_exhibit, key: "#{current_exhibit.slug}.subtitle", locale: @language) %> | ||
<%= f.fields_for :translations, translation do |translation_fields| %> | ||
<%= translation_fields.hidden_field :key %> | ||
<%= translation_fields.hidden_field :locale %> | ||
<div class='form-group translation-form'> | ||
<%= translation_fields.label :value, 'Subtitle', class: 'control-label col-sm-2' %> | ||
<div class='col-md-8 panel panel-body panel-translation'> | ||
<%= translation_fields.text_field_without_bootstrap :value, class: 'form-control' %> | ||
<p class="help-block"> | ||
<%= current_exhibit.subtitle %> | ||
</p> | ||
</div> | ||
<div class='col-md-2'> | ||
<% if translation.value.present? %> | ||
<span class='glyphicon glyphicon-ok'></span> | ||
<% end %> | ||
</div> | ||
</div> | ||
<% end %> | ||
<div class="form-actions"> | ||
<div class="primary-actions"> | ||
<%= f.submit nil, class: 'btn btn-primary' %> | ||
</div> | ||
</div> | ||
<% end %> | ||
</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