ideyabox 0.1.4 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -15,7 +15,7 @@ $(document).ready(function(){
15
15
 
16
16
  $(".chosen_select").chosen();
17
17
  $('.pagination').hide();
18
-
18
+ $("ol.sortable ol").hide();
19
19
 
20
20
 
21
21
  $('.zebra th a').live('click', function () {
@@ -29,6 +29,15 @@ $(document).ready(function(){
29
29
 
30
30
  });
31
31
 
32
+ $("ol.sortable").on('click', 'a.expand', function(e){
33
+ e.preventDefault();
34
+ var $inList = $(this).parent('div').siblings("ol");
35
+ $inList.toggle();
36
+ $(this).toggleClass('minus');
37
+ $(this).toggleClass('plus');
38
+ });
39
+
40
+
32
41
  $('#sort_button').on('click', function (e) {
33
42
  $.ajax( {
34
43
  type: 'post',
@@ -81,4 +90,10 @@ $(document).ready(function(){
81
90
  $('.crop_params input').val('');
82
91
  });
83
92
 
93
+ });
94
+
95
+ $(function() {
96
+ $( "#accordion" ).accordion({
97
+ heightStyle: "content"
98
+ });
84
99
  });
@@ -33,6 +33,18 @@ a.del {
33
33
  i {display:inline;}
34
34
  &:hover {color:#FF0000;}
35
35
  }
36
+
37
+ @mixin radius($radius) {
38
+ -webkit-border-radius: $radius;
39
+ -moz-border-radius: $radius;
40
+ border-radius: $radius;
41
+ }
42
+ @mixin box-shadow($blur, $color) {
43
+ -webkit-box-shadow: 0 0 $blur $color;
44
+ -moz-box-shadow: 0 0 $blur $color;
45
+ box-shadow: 0 0 $blur $color;
46
+ }
47
+
36
48
  .icon-large{font-size:1.5em;}
37
49
  .horizontal_items {
38
50
  display:none;
@@ -514,7 +526,7 @@ ol.sortable {
514
526
  width: 100%;
515
527
  li {
516
528
  width:100%;
517
- margin: 12px 0;
529
+ margin: 5px 0;
518
530
  vertical-align: middle;
519
531
  padding: 0;
520
532
  }
@@ -524,13 +536,45 @@ ol.sortable {
524
536
  background-color: #F8F8F8;
525
537
  width:100%;
526
538
  vertical-align: middle;
527
- padding: 10px 0;
528
- a {margin-left: 10px;}
539
+ padding: 5px 0;
540
+ position: relative;
541
+ border:1px solid #000;
542
+ @include radius(7px);
543
+ a {position: relative;}
544
+
545
+ a.title {margin-left: 30px;}
546
+ a.expand {
547
+ &.plus:after {content:"+";}
548
+ &.minus {
549
+ &:after {content:"-";}
550
+ padding: 0 5px 2px 5px;
551
+ }
552
+ margin-left: 10px;
553
+ font-size: 15px;
554
+ font-weight: bold;
555
+ background-color: $deepgreen;
556
+ display: inline-block;
557
+ padding: 0 4px 2px 4px;
558
+ color: #FFF;
559
+ &:hover{color: #FFF;}
560
+ &.non-display {display:none;}
561
+ @include radius(10px);
562
+ }
563
+ .toggleshow {position: relative;margin-left: 5px;display: inline-block;width: 12px;height: 12px;}
564
+ a.del {margin-right: 10px;}
565
+ .icon-large{font-size: 1.2em;position: absolute;left: 0;top: 0;}
566
+
529
567
  .del {float: right;min-width:30px;}
530
- &:hover {background-color:#C4FFCB;outline:1px dashed green;}
568
+ &:hover {background-color:#C4FFCB;border:1px dashed green;}
531
569
  }
532
570
  }
533
- .ui-nestedSortable-error {background:#fbe3e4; outline:1px dashed red;}
534
- .placeholder {background-color: #C4FFCB; outline:1px dashed green;}
571
+ .ui-nestedSortable-error {background:#fbe3e4; border:1px dashed red;}
572
+ .placeholder {background-color: #C4FFCB; border:1px dashed green;@include radius(7px);}
535
573
  .ui-sortable-placeholder {background-color: #C4FFCB !important;height:2.6em;visibility:visible !important;}
536
574
 
575
+ #accordion {
576
+ h1,h2,h3,h4 {
577
+ cursor:pointer;
578
+ &:hover {color:$a_hover_color;}
579
+ }
580
+ }
@@ -146,10 +146,16 @@ module AdminHelper
146
146
 
147
147
  def children(i)
148
148
  html = ""
149
- html << "
150
- <li id=\"list_#{i.id}\">
151
- <div>#{link_to i.title, [:edit, :admin, i]}
152
- "
149
+ html << "<li id=\"list_#{i.id}\">"
150
+ html <<"<div>"
151
+
152
+ html << expand_button(i)
153
+ if i.has_attribute?("visible")
154
+ html << visible_button(i)
155
+ end
156
+ html <<"#{link_to i.title, [:edit, :admin, i], :class=>'title'}"
157
+
158
+
153
159
  html << delete_button(i)
154
160
  html << "</div>"
155
161
 
@@ -165,6 +171,16 @@ module AdminHelper
165
171
  return html
166
172
  end
167
173
 
174
+ def expand_button(i)
175
+ link_to '', '#', :class=>"expand plus #{'non-display' if i.children.empty?}"
176
+ end
177
+
178
+ def visible_button(object)
179
+ link_to [:toggleshow, :admin, object], :remote => true, :class=>"toggleshow" do
180
+ raw("<i class=\'#{object.visible? ? 'icon-eye-open icon-large' : 'icon-eye-close icon-large not-work'}\'></i>")
181
+ end
182
+ end
183
+
168
184
  def delete_button(object)
169
185
  link_to [:admin, object], :class => :del, :confirm => 'Точно удалить?', :method => :delete do
170
186
  raw("<span> Удалить </span>")
@@ -193,6 +209,20 @@ module AdminHelper
193
209
  update: function(){
194
210
  var serialized = $('ol.sortable').nestedSortable('serialize');
195
211
  $.ajax({url: '#{url}', data: serialized});
212
+
213
+ $('ol.sortable .expand').each(function(){
214
+ var $inlist = $(this).parent('div').siblings("ol").first();
215
+ if ($inlist.find('li').length === 0) {
216
+ $(this).addClass('non-display');
217
+ } else {
218
+ if ($inlist.css('display') == 'none') {
219
+ $(this).addClass('plus').removeClass('minus');
220
+ } else {
221
+ $(this).addClass('minus').removeClass('plus');
222
+ }
223
+ $(this).removeClass('non-display');
224
+ }
225
+ });
196
226
  }
197
227
  });
198
228
  });
@@ -1,3 +1,4 @@
1
1
  //*= require default
2
+ //= require redactor-rails
2
3
  //
3
4
  //*= require_self
@@ -1,3 +1,3 @@
1
1
  module Ideyabox
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ideyabox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-12-08 00:00:00.000000000 Z
13
+ date: 2012-12-16 00:00:00.000000000 Z
14
14
  dependencies: []
15
15
  description: Write a gem description
16
16
  email: