-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make content blocks editable in settings UI
Fixes #74
- Loading branch information
Showing
16 changed files
with
97 additions
and
52 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 @@ | ||
//= require batch_edit/batch_edit |
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 @@ | ||
@import 'batch_edit/batch_edit'; |
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,3 +1,4 @@ | ||
module ApplicationHelper | ||
include ::SufiaHelper | ||
include ContentBlockHelper | ||
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
module ContentBlockHelper | ||
include Sufia::ContentBlockHelperBehavior | ||
|
||
def displayable_content_block(content_block, **options) | ||
return if content_block.value.blank? | ||
content_tag :div, content_block.value, options | ||
end | ||
|
||
def editable_content_block(content_block) | ||
capture do | ||
concat form_for([sufia, content_block]) { |f| | ||
concat f.label :value, content_block.name.titleize | ||
concat f.text_area :value, class: "tinymce", rows: 20, cols: 120 | ||
concat f.submit 'Save', class: "btn btn-primary" | ||
} | ||
concat tinymce_assets | ||
concat tinymce | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<div role="tabpanel" class="tab-pane" id="content_blocks"> | ||
<%= editable_content_block @announcement_text %> | ||
<%= editable_content_block @marketing_text %> | ||
<%= editable_content_block @featured_researcher %> | ||
</div> |
This file was deleted.
Oops, something went wrong.
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,32 @@ | ||
<div role="tabpanel" class="tab-pane active" id="labels"> | ||
<%= form_for(@site, url: site_path) do |f| %> | ||
<% if @site.errors.any? %> | ||
<div id="error_explanation"> | ||
<h2><%= pluralize(@site.errors.count, "error") %> prohibited this site from being saved:</h2> | ||
|
||
<ul> | ||
<% @site.errors.full_messages.each do |message| %> | ||
<li><%= message %></li> | ||
<% end %> | ||
</ul> | ||
</div> | ||
<% end %> | ||
|
||
<div class="field form-group"> | ||
<%= f.label :application_name %><br> | ||
<%= f.text_field :application_name, class: 'form-control'%> | ||
</div> | ||
|
||
<div class="field form-group"> | ||
<%= f.label :institution_name %><br> | ||
<%= f.text_field :institution_name, class: 'form-control'%> | ||
</div> | ||
|
||
<div class="field form-group"> | ||
<%= f.label :institution_name_full %><br> | ||
<%= f.text_field :institution_name_full, class: 'form-control'%> | ||
</div> | ||
|
||
<%= f.submit class: 'btn btn-primary' %> | ||
<% 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,17 @@ | ||
<h1>Editing Site</h1> | ||
<h1>Settings</h1> | ||
|
||
<%= render 'form' %> | ||
<nav id="admin-nav" role="navigation"> | ||
<ul class="nav nav-pills" role="tablist"> | ||
<li role="presentation" class="active"> | ||
<a href="#labels" aria-controls="labels" role="tab" data-toggle="pill">Labels</a> | ||
</li> | ||
<li role="presentation"> | ||
<a href="#content_blocks" aria-controls="content_blocks" role="tab" data-toggle="pill">Content Blocks</a> | ||
</li> | ||
</ul> | ||
|
||
<div class="tab-content"> | ||
<%= render 'settings_tab' %> | ||
<%= render 'content_blocks_tab' %> | ||
</div> | ||
</nav> |
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 @@ | ||
<%= displayable_content_block @announcement_text, class: 'row', id: 'announcement' %> |
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 @@ | ||
<h2>Featured Researcher</h2> | ||
<%= link_to 'View other featured researchers', sufia.featured_researchers_path %> | ||
<%= displayable_content_block @featured_researcher %> |
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 @@ | ||
<%= displayable_content_block @marketing_text, class: 'col-sm-offset-2 col-sm-9 col-md-offset-1 home_marketing_text' %> |
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