app/views/pages_cms/admin/pages/edit.html.haml in pages_cms-0.2.0 vs app/views/pages_cms/admin/pages/edit.html.haml in pages_cms-0.2.1
- old
+ new
@@ -40,20 +40,29 @@
%div.col-md-3
%h4 Sidebar
= f.fields_for :sidebar, @sidebar do |ss|
= render 'editor', f: ss
+ %input.form-control.inline-form{ id: 'add_sid', placeholder: 'add link' }
+ %a{ href: 'javascript:;', onclick: 'addOption("select_sid", "add_sid")' } Add
= ss.label 'Show sidebar on this page'
= ss.check_box :show
- = ss.select(:use_instead, PagesCms::Page.all.includes(:sidebar).collect {|p| [p.title, p.sidebar.id] unless p.sidebar.nil? }, {include_blank: 'Use this sidebar instead'}, class: 'form-control inline-form')
+ = ss.select(:use_instead, PagesCms::Page.all.includes(:sidebar).collect {|p| [p.title, p.sidebar.id] unless p.sidebar.nil? }, {include_blank: 'Use this sidebar instead'}, class: 'form-control inline-form', id: 'select_sid')
= f.submit 'Save', class: 'btn btn-primary center-block'
:javascript
$( document ).ready(function() {
$('.sortable').sortable();
$('.sortable').sortable().bind('sortupdate', function() {
$('.block-order').each(function(i){ $(this).val(i+1) })
});
})
+
+ function addOption(id,target) {
+ var x = document.getElementById(id + random);
+ var option = document.createElement("option");
+ option.text = document.getElementById(target + random).value;
+ x.add(option);
+ }
= javascript_include_tag 'pages_cms/sortable.js'
\ No newline at end of file