Commit 486baced by David Baumgold

Clean up HTML structure in textbooks page

parent 4509dc03
<% if (errors) { %> <form class="edit-textbook" id="edit_textbook_form">
<div id="edit_textbook_error" class="message message-status message-status error" name="edit_textbook_error"> <% if (errors) { %>
<%= errors %> <div id="edit_textbook_error" class="message message-status message-status error" name="edit_textbook_error">
</div> <%= errors %>
<% } %> </div>
<% } %>
<fieldset class="textbook"> <fieldset class="textbook">
<legend class="sr"><%= gettext("Textbook information") %></legend> <legend class="sr"><%= gettext("Textbook information") %></legend>
<div class="input-wrap field text required add-textbook-name"> <div class="input-wrap field text required add-textbook-name">
<label for="textbook-name-input"><%= gettext("Textbook Name") %></label> <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 %>"> <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> <span class="tip tip-stacked"><%= gettext("the title/name of the text book as you would like your students to see it.") %></span>
</div> </div>
</fieldset> </fieldset>
<fieldset class="chapters"> <fieldset class="chapters">
<legend class="sr"><%= gettext("Chapter(s) information") %></legend> <legend class="sr"><%= gettext("Chapter(s) information") %></legend>
<ol class="chapters list-input enum"></ol> <ol class="chapters list-input enum"></ol>
</fieldset> </fieldset>
<div class="actions"> <div class="actions">
<button class="action action-add-chapter"><i class="icon-plus"></i> <%= gettext("Add a Chapter") %></button> <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-primary" type="submit"><%= gettext("Save") %></button>
<button class="action action-secondary action-cancel"><%= gettext("Cancel") %></button> <button class="action action-secondary action-cancel"><%= gettext("Cancel") %></button>
</div> </div>
</form>
<li class="textbook"> <span class="name"><%= name %></span>
<span class="name"><%= name %></span> <% if(chapters.length > 1) {%>
<% if(chapters.length > 1) {%> <a href="#" class="chapter-toggle
<a href="#" class="chapter-toggle <% if(showChapters){ print('hide'); } else { print('show'); } %>-chapters">
<% if(showChapters){ print('hide'); } else { print('show'); } %>-chapters"> <i class="icon-chevron-<% if(showChapters){ print('down'); } else { print('right'); } %>"></i>
<i class="icon-chevron-<% if(showChapters){ print('down'); } else { print('right'); } %>"></i> <%= chapters.length %> PDF Chapters
<%= chapters.length %> PDF Chapters </a>
</a> <% } else if(chapters.length === 1) { %>
<% } else if(chapters.length === 1) { %> <%= chapters.at(0).get("asset_path") %>
<%= chapters.at(0).get("asset_path") %> <% } %>
<% } %> <a href="#" class="view"><%= gettext("view in course") %></a>
<a href="#" class="view"><%= gettext("view in course") %></a> <button class="edit"><%= gettext("Edit") %></button>
<button class="edit"><%= gettext("Edit") %></button> <button class="delete"><%= gettext("Delete") %></button>
<button class="delete"><%= gettext("Delete") %></button> <% if(showChapters) { %>
<% if(showChapters) { %> <hr>
<hr> <ol class="chapters">
<ol class="chapters"> <% chapters.each(function(chapter) { %>
<% chapters.each(function(chapter) { %> <li><span class="chapter-name"><%= chapter.get('name') %></span>
<li><span class="chapter-name"><%= chapter.get('name') %></span> <span class="chapter-asset-path"><%= chapter.get('asset_path') %></span>
<span class="chapter-asset-path"><%= chapter.get('asset_path') %></span> </li>
</li> <% }) %>
<% }) %> </ol>
</ol> <% } %>
<% } %>
</li>
...@@ -72,6 +72,7 @@ CMS.Views.TextbookShow = Backbone.View.extend({ ...@@ -72,6 +72,7 @@ CMS.Views.TextbookShow = Backbone.View.extend({
this.template = _.template($("#show-textbook-tpl").text()); this.template = _.template($("#show-textbook-tpl").text());
this.listenTo(this.model, "change", this.render); this.listenTo(this.model, "change", this.render);
}, },
tagName: "li",
events: { events: {
"click .edit": "editTextbook", "click .edit": "editTextbook",
"click .delete": "removeSelf", "click .delete": "removeSelf",
...@@ -108,9 +109,7 @@ CMS.Views.TextbookEdit = Backbone.View.extend({ ...@@ -108,9 +109,7 @@ CMS.Views.TextbookEdit = Backbone.View.extend({
this.listenTo(chapters, "all", this.render); this.listenTo(chapters, "all", this.render);
this.listenTo(this.model.collection, "editOne", this.remove); this.listenTo(this.model.collection, "editOne", this.remove);
}, },
tagName: "form", tagName: "li",
className: "edit-textbook",
id: "edit_textbook_form",
render: function() { render: function() {
this.$el.html(this.template({ this.$el.html(this.template({
name: this.model.escape('name'), name: this.model.escape('name'),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment