Clean up HTML structure in textbooks page
This commit is contained in:
@@ -1,24 +1,26 @@
|
||||
<% if (errors) { %>
|
||||
<div id="edit_textbook_error" class="message message-status message-status error" name="edit_textbook_error">
|
||||
<%= errors %>
|
||||
<form class="edit-textbook" id="edit_textbook_form">
|
||||
<% if (errors) { %>
|
||||
<div id="edit_textbook_error" class="message message-status message-status error" name="edit_textbook_error">
|
||||
<%= errors %>
|
||||
</div>
|
||||
<% } %>
|
||||
|
||||
<fieldset class="textbook">
|
||||
<legend class="sr"><%= gettext("Textbook information") %></legend>
|
||||
<div class="input-wrap field text required add-textbook-name">
|
||||
<label for="textbook-name-input"><%= gettext("Textbook Name") %></label>
|
||||
<input id="textbook-name-input" name="textbook-name" type="text" placeholder="<%= gettext("Introduction to Cookie Baking") %>" value="<%= name %>">
|
||||
<span class="tip tip-stacked"><%= gettext("the title/name of the text book as you would like your students to see it.") %></span>
|
||||
</div>
|
||||
</fieldset>
|
||||
<fieldset class="chapters">
|
||||
<legend class="sr"><%= gettext("Chapter(s) information") %></legend>
|
||||
<ol class="chapters list-input enum"></ol>
|
||||
</fieldset>
|
||||
|
||||
<div class="actions">
|
||||
<button class="action action-add-chapter"><i class="icon-plus"></i> <%= gettext("Add a Chapter") %></button>
|
||||
<button class="action action-primary" type="submit"><%= gettext("Save") %></button>
|
||||
<button class="action action-secondary action-cancel"><%= gettext("Cancel") %></button>
|
||||
</div>
|
||||
<% } %>
|
||||
|
||||
<fieldset class="textbook">
|
||||
<legend class="sr"><%= gettext("Textbook information") %></legend>
|
||||
<div class="input-wrap field text required add-textbook-name">
|
||||
<label for="textbook-name-input"><%= gettext("Textbook Name") %></label>
|
||||
<input id="textbook-name-input" name="textbook-name" type="text" placeholder="<%= gettext("Introduction to Cookie Baking") %>" value="<%= name %>">
|
||||
<span class="tip tip-stacked"><%= gettext("the title/name of the text book as you would like your students to see it.") %></span>
|
||||
</div>
|
||||
</fieldset>
|
||||
<fieldset class="chapters">
|
||||
<legend class="sr"><%= gettext("Chapter(s) information") %></legend>
|
||||
<ol class="chapters list-input enum"></ol>
|
||||
</fieldset>
|
||||
|
||||
<div class="actions">
|
||||
<button class="action action-add-chapter"><i class="icon-plus"></i> <%= gettext("Add a Chapter") %></button>
|
||||
<button class="action action-primary" type="submit"><%= gettext("Save") %></button>
|
||||
<button class="action action-secondary action-cancel"><%= gettext("Cancel") %></button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -1,25 +1,23 @@
|
||||
<li class="textbook">
|
||||
<span class="name"><%= name %></span>
|
||||
<% if(chapters.length > 1) {%>
|
||||
<a href="#" class="chapter-toggle
|
||||
<% if(showChapters){ print('hide'); } else { print('show'); } %>-chapters">
|
||||
<i class="icon-chevron-<% if(showChapters){ print('down'); } else { print('right'); } %>"></i>
|
||||
<%= chapters.length %> PDF Chapters
|
||||
</a>
|
||||
<% } else if(chapters.length === 1) { %>
|
||||
<%= chapters.at(0).get("asset_path") %>
|
||||
<% } %>
|
||||
<a href="#" class="view"><%= gettext("view in course") %></a>
|
||||
<button class="edit"><%= gettext("Edit") %></button>
|
||||
<button class="delete"><%= gettext("Delete") %></button>
|
||||
<% if(showChapters) { %>
|
||||
<hr>
|
||||
<ol class="chapters">
|
||||
<% chapters.each(function(chapter) { %>
|
||||
<li><span class="chapter-name"><%= chapter.get('name') %></span>
|
||||
<span class="chapter-asset-path"><%= chapter.get('asset_path') %></span>
|
||||
</li>
|
||||
<% }) %>
|
||||
</ol>
|
||||
<% } %>
|
||||
</li>
|
||||
<span class="name"><%= name %></span>
|
||||
<% if(chapters.length > 1) {%>
|
||||
<a href="#" class="chapter-toggle
|
||||
<% if(showChapters){ print('hide'); } else { print('show'); } %>-chapters">
|
||||
<i class="icon-chevron-<% if(showChapters){ print('down'); } else { print('right'); } %>"></i>
|
||||
<%= chapters.length %> PDF Chapters
|
||||
</a>
|
||||
<% } else if(chapters.length === 1) { %>
|
||||
<%= chapters.at(0).get("asset_path") %>
|
||||
<% } %>
|
||||
<a href="#" class="view"><%= gettext("view in course") %></a>
|
||||
<button class="edit"><%= gettext("Edit") %></button>
|
||||
<button class="delete"><%= gettext("Delete") %></button>
|
||||
<% if(showChapters) { %>
|
||||
<hr>
|
||||
<ol class="chapters">
|
||||
<% chapters.each(function(chapter) { %>
|
||||
<li><span class="chapter-name"><%= chapter.get('name') %></span>
|
||||
<span class="chapter-asset-path"><%= chapter.get('asset_path') %></span>
|
||||
</li>
|
||||
<% }) %>
|
||||
</ol>
|
||||
<% } %>
|
||||
|
||||
@@ -72,6 +72,7 @@ CMS.Views.TextbookShow = Backbone.View.extend({
|
||||
this.template = _.template($("#show-textbook-tpl").text());
|
||||
this.listenTo(this.model, "change", this.render);
|
||||
},
|
||||
tagName: "li",
|
||||
events: {
|
||||
"click .edit": "editTextbook",
|
||||
"click .delete": "removeSelf",
|
||||
@@ -108,9 +109,7 @@ CMS.Views.TextbookEdit = Backbone.View.extend({
|
||||
this.listenTo(chapters, "all", this.render);
|
||||
this.listenTo(this.model.collection, "editOne", this.remove);
|
||||
},
|
||||
tagName: "form",
|
||||
className: "edit-textbook",
|
||||
id: "edit_textbook_form",
|
||||
tagName: "li",
|
||||
render: function() {
|
||||
this.$el.html(this.template({
|
||||
name: this.model.escape('name'),
|
||||
|
||||
Reference in New Issue
Block a user