interview 0.0.1 → 0.0.6
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.
- checksums.yaml +4 -4
- data/interview.gemspec +4 -0
- data/lib/generators/interview/install/install_generator.rb +47 -0
- data/lib/generators/interview/install/templates/32px.png +0 -0
- data/lib/generators/interview/install/templates/40px.png +0 -0
- data/lib/generators/interview/install/templates/application.js +22 -0
- data/lib/generators/interview/install/templates/bootstrap_interview.css.scss +98 -0
- data/lib/generators/interview/install/templates/ckeditor_config.js +19 -0
- data/lib/generators/interview/install/templates/colors.css.scss +2 -0
- data/lib/generators/interview/install/templates/defaults_de.yml +204 -0
- data/lib/generators/interview/install/templates/interview.js.coffee +72 -0
- data/lib/generators/interview/install/templates/interview.rb +4 -0
- data/lib/generators/interview/install/templates/jstree.css +916 -0
- data/lib/generators/interview/install/templates/jstree.js +5892 -0
- data/lib/generators/interview/install/templates/missing_large.png +0 -0
- data/lib/generators/interview/install/templates/missing_medium.png +0 -0
- data/lib/generators/interview/install/templates/missing_thumb.png +0 -0
- data/lib/generators/interview/install/templates/throbber.gif +0 -0
- data/lib/generators/interview/install/templates/views_defaults_de.yml +8 -0
- data/lib/generators/interview/view_control/templates/card.rb +6 -0
- data/lib/generators/interview/view_control/templates/form.rb +6 -0
- data/lib/generators/interview/view_control/templates/list.rb +6 -0
- data/lib/generators/interview/view_control/view_control_generator.rb +34 -0
- data/lib/interview/actionbar.rb +38 -0
- data/lib/interview/association_attribute.rb +33 -0
- data/lib/interview/association_list_attribute.rb +36 -0
- data/lib/interview/association_methods.rb +23 -0
- data/lib/interview/attribute.rb +141 -0
- data/lib/interview/boolean_attribute.rb +59 -0
- data/lib/interview/breadcrumbs.rb +21 -0
- data/lib/interview/container_attribute.rb +30 -0
- data/lib/interview/control.rb +73 -0
- data/lib/interview/control_def.rb +36 -0
- data/lib/interview/date_attribute.rb +20 -0
- data/lib/interview/datetime_attribute.rb +20 -0
- data/lib/interview/decimal_attribute.rb +10 -0
- data/lib/interview/dropdown.rb +26 -0
- data/lib/interview/form.rb +69 -0
- data/lib/interview/form_errors.rb +22 -0
- data/lib/interview/grid.rb +53 -0
- data/lib/interview/has_controls.rb +43 -0
- data/lib/interview/hidden_attribute.rb +15 -0
- data/lib/interview/html_control.rb +15 -0
- data/lib/interview/html_text_attribute.rb +19 -0
- data/lib/interview/image_attribute.rb +34 -0
- data/lib/interview/integer_attribute.rb +5 -0
- data/lib/interview/link.rb +129 -0
- data/lib/interview/list.rb +21 -0
- data/lib/interview/navigation.rb +55 -0
- data/lib/interview/navigation_item.rb +26 -0
- data/lib/interview/nested_form.rb +51 -0
- data/lib/interview/nested_form_add_link.rb +80 -0
- data/lib/interview/nested_form_remove_link.rb +28 -0
- data/lib/interview/object_context.rb +17 -0
- data/lib/interview/option_attribute.rb +74 -0
- data/lib/interview/polymorphic_add_link.rb +28 -0
- data/lib/interview/space.rb +18 -0
- data/lib/interview/string_attribute.rb +5 -0
- data/lib/interview/tab.rb +21 -0
- data/lib/interview/tab_box.rb +29 -0
- data/lib/interview/text.rb +15 -0
- data/lib/interview/text_attribute.rb +21 -0
- data/lib/interview/tooltip.rb +38 -0
- data/lib/interview/tree.rb +33 -0
- data/lib/interview/version.rb +1 -1
- data/lib/interview/view.rb +87 -0
- data/lib/interview.rb +196 -0
- metadata +107 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1243093b8b45f1cde37f11136901f07adbe3284d
|
4
|
+
data.tar.gz: 565c2aed48243fa5fd0a996095cc6d150bb6caab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1bcec915d352d14a1a52e35028d3c59e8d0948e305a811f474c7eff716e16df9c1b52f2df2ed5817c6972f89fc3ca64d327be673651a9cce2bcbea1a5350cbe3
|
7
|
+
data.tar.gz: 1a8d6447c720d09fd9fa21e8af4c9540e2fe67a4e56cf07b0478a1e1803bfb0404a514ad991215ff0a382b06a935fe94df0d528f4efab2bfcacbbef624ff8103
|
data/interview.gemspec
CHANGED
@@ -20,4 +20,8 @@ Gem::Specification.new do |spec|
|
|
20
20
|
|
21
21
|
spec.add_development_dependency "bundler", "~> 1.3"
|
22
22
|
spec.add_development_dependency "rake"
|
23
|
+
|
24
|
+
spec.add_runtime_dependency "activesupport"
|
25
|
+
spec.add_runtime_dependency "draper"
|
26
|
+
spec.add_runtime_dependency "builder"
|
23
27
|
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
|
3
|
+
module Interview
|
4
|
+
module Generators
|
5
|
+
class InstallGenerator < ::Rails::Generators::Base
|
6
|
+
|
7
|
+
source_root File.expand_path("../templates", __FILE__)
|
8
|
+
desc "This generator installs Interview"
|
9
|
+
|
10
|
+
def add_view_controls
|
11
|
+
empty_directory "app/view_controls"
|
12
|
+
end
|
13
|
+
|
14
|
+
def add_assets
|
15
|
+
copy_file "bootstrap_interview.css.scss", "app/assets/stylesheets/bootstrap_interview.css.scss"
|
16
|
+
copy_file "colors.css.scss", "app/assets/stylesheets/colors.css.scss"
|
17
|
+
copy_file "application.js", "app/assets/javascripts/application.js" # todo: überdenken
|
18
|
+
copy_file "interview.js.coffee", "app/assets/javascripts/interview.js.coffee"
|
19
|
+
copy_file "missing_thumb.png", "app/assets/images/missing_thumb.png"
|
20
|
+
copy_file "missing_medium.png", "app/assets/images/missing_medium.png"
|
21
|
+
copy_file "missing_large.png", "app/assets/images/missing_large.png"
|
22
|
+
copy_file "32px.png", "app/assets/images/32px.png"
|
23
|
+
copy_file "40px.png", "app/assets/images/40px.png"
|
24
|
+
copy_file "throbber.gif", "app/assets/images/throbber.gif"
|
25
|
+
copy_file "jstree.css", "app/assets/stylesheets/jstree.css"
|
26
|
+
copy_file "jstree.js", "app/assets/javascripts/jstree.js"
|
27
|
+
end
|
28
|
+
|
29
|
+
def add_initializers
|
30
|
+
copy_file "interview.rb", "config/initializers/interview.rb" # todo: überarbeiten
|
31
|
+
end
|
32
|
+
|
33
|
+
def add_locales
|
34
|
+
copy_file "defaults_de.yml", "config/locales/defaults_de.yml"
|
35
|
+
empty_directory "config/locales/views"
|
36
|
+
copy_file "views_defaults_de.yml", "config/locales/views/defaults_de.yml"
|
37
|
+
empty_directory "config/locales/models"
|
38
|
+
end
|
39
|
+
|
40
|
+
def install_ckeditor
|
41
|
+
empty_directory "app/assets/javascripts/ckeditor"
|
42
|
+
copy_file "ckeditor_config.js", "app/assets/javascripts/ckeditor/config.js"
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
Binary file
|
Binary file
|
@@ -0,0 +1,22 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// compiled file.
|
9
|
+
//
|
10
|
+
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
|
11
|
+
// about supported directives.
|
12
|
+
//
|
13
|
+
//= require jquery
|
14
|
+
//= require jquery.turbolinks
|
15
|
+
//= require jquery_ujs
|
16
|
+
//= require bootstrap
|
17
|
+
//= require underscore
|
18
|
+
//= require jquery.ui.sortable
|
19
|
+
//= require jquery.ui.effect-highlight
|
20
|
+
//= require interview
|
21
|
+
//= require_tree .
|
22
|
+
//= require turbolinks
|
@@ -0,0 +1,98 @@
|
|
1
|
+
@import 'font-awesome';
|
2
|
+
|
3
|
+
@import 'colors';
|
4
|
+
|
5
|
+
$navbar-default-brand-color: $brand-primary;
|
6
|
+
$navbar-default-bg: $brand-primary-lighten;
|
7
|
+
|
8
|
+
@import 'bootstrap';
|
9
|
+
|
10
|
+
$actionbar-padding: 5px !default;
|
11
|
+
$actionbar-margin-bottom: 0px !default;
|
12
|
+
|
13
|
+
.actionbar {
|
14
|
+
> ul {
|
15
|
+
list-style: none;
|
16
|
+
padding-left: 0;
|
17
|
+
margin-bottom: $actionbar-margin-bottom;
|
18
|
+
margin-left: -$actionbar-padding;
|
19
|
+
|
20
|
+
> li {
|
21
|
+
display: inline-block;
|
22
|
+
padding-left: $actionbar-padding;
|
23
|
+
padding-right: $actionbar-padding;
|
24
|
+
}
|
25
|
+
}
|
26
|
+
|
27
|
+
.actionbar-right {
|
28
|
+
float: right !important;
|
29
|
+
margin-right: -$actionbar-padding;
|
30
|
+
}
|
31
|
+
|
32
|
+
.actionbar-title {
|
33
|
+
font-size: $font-size-large;
|
34
|
+
}
|
35
|
+
|
36
|
+
.btn {
|
37
|
+
@include button-size($padding-small-vertical, $padding-small-horizontal, $font-size-small, $line-height-small, $border-radius-small);
|
38
|
+
}
|
39
|
+
|
40
|
+
}
|
41
|
+
|
42
|
+
|
43
|
+
$caption-list-margin-bottom: ($line-height-computed / 2) !default;
|
44
|
+
|
45
|
+
.caption-list {
|
46
|
+
dd {
|
47
|
+
margin-bottom: $caption-list-margin-bottom;
|
48
|
+
}
|
49
|
+
dd.dd-only {
|
50
|
+
margin-left: 0;
|
51
|
+
}
|
52
|
+
}
|
53
|
+
|
54
|
+
.caption-list.dl-horizontal {
|
55
|
+
dt {
|
56
|
+
text-align: left;
|
57
|
+
}
|
58
|
+
}
|
59
|
+
|
60
|
+
|
61
|
+
$nav-stacked-link-padding-level1: 5px 15px 5px 30px !default;
|
62
|
+
$nav-stacked-link-padding-level2: 5px 15px 5px 45px !default;
|
63
|
+
|
64
|
+
.nav.nav-pills.nav-stacked {
|
65
|
+
> li.level0 > a {
|
66
|
+
font-weight: bold;
|
67
|
+
}
|
68
|
+
> li.level1 > a {
|
69
|
+
padding: $nav-stacked-link-padding-level1;
|
70
|
+
}
|
71
|
+
> li.level2 > a {
|
72
|
+
padding: $nav-stacked-link-padding-level1;
|
73
|
+
}
|
74
|
+
}
|
75
|
+
|
76
|
+
.popover-content {
|
77
|
+
font-size: $font-size-base;
|
78
|
+
font-weight: normal;
|
79
|
+
}
|
80
|
+
|
81
|
+
.popover {
|
82
|
+
width: $popover-max-width;
|
83
|
+
}
|
84
|
+
|
85
|
+
.handle {
|
86
|
+
cursor: pointer;
|
87
|
+
color: $brand-primary;
|
88
|
+
}
|
89
|
+
|
90
|
+
.alert-info {
|
91
|
+
border: 1px solid;
|
92
|
+
}
|
93
|
+
|
94
|
+
.form-inline {
|
95
|
+
input {
|
96
|
+
width: auto;
|
97
|
+
}
|
98
|
+
}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
//= require ckeditor/init
|
2
|
+
|
3
|
+
CKEDITOR.editorConfig = function( config )
|
4
|
+
{
|
5
|
+
config.enterMode = CKEDITOR.ENTER_BR;
|
6
|
+
config.toolbar = 'InterviewDefault';
|
7
|
+
|
8
|
+
config.toolbar_InterviewDefault =
|
9
|
+
[
|
10
|
+
{ name: 'font', items : [ 'Format','FontSize' ] },
|
11
|
+
{ name: 'basicstyles', items : [ 'Underline','Bold','Italic','Strike' ] },
|
12
|
+
{ name: 'colors', items : [ 'TextColor','BGColor' ] },
|
13
|
+
{ name: 'paragraph', items : [ 'NumberedList','BulletedList','-','Outdent','Indent' ] },
|
14
|
+
{ name: 'justify', items : [ 'JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'] },
|
15
|
+
{ name: 'insert', items : [ 'Link','Table' ] },
|
16
|
+
{ name: 'tools', items : [ 'Maximize','-','Source' ] }
|
17
|
+
];
|
18
|
+
|
19
|
+
};
|
@@ -0,0 +1,204 @@
|
|
1
|
+
# https://github.com/svenfuchs/rails-i18n/tree/master/rails/locale
|
2
|
+
de:
|
3
|
+
date:
|
4
|
+
abbr_day_names:
|
5
|
+
- So
|
6
|
+
- Mo
|
7
|
+
- Di
|
8
|
+
- Mi
|
9
|
+
- Do
|
10
|
+
- Fr
|
11
|
+
- Sa
|
12
|
+
abbr_month_names:
|
13
|
+
-
|
14
|
+
- Jan
|
15
|
+
- Feb
|
16
|
+
- Mär
|
17
|
+
- Apr
|
18
|
+
- Mai
|
19
|
+
- Jun
|
20
|
+
- Jul
|
21
|
+
- Aug
|
22
|
+
- Sep
|
23
|
+
- Okt
|
24
|
+
- Nov
|
25
|
+
- Dez
|
26
|
+
day_names:
|
27
|
+
- Sonntag
|
28
|
+
- Montag
|
29
|
+
- Dienstag
|
30
|
+
- Mittwoch
|
31
|
+
- Donnerstag
|
32
|
+
- Freitag
|
33
|
+
- Samstag
|
34
|
+
formats:
|
35
|
+
default: ! '%d.%m.%Y'
|
36
|
+
long: ! '%e. %B %Y'
|
37
|
+
short: ! '%e. %b'
|
38
|
+
month_names:
|
39
|
+
-
|
40
|
+
- Januar
|
41
|
+
- Februar
|
42
|
+
- März
|
43
|
+
- April
|
44
|
+
- Mai
|
45
|
+
- Juni
|
46
|
+
- Juli
|
47
|
+
- August
|
48
|
+
- September
|
49
|
+
- Oktober
|
50
|
+
- November
|
51
|
+
- Dezember
|
52
|
+
order:
|
53
|
+
- :day
|
54
|
+
- :month
|
55
|
+
- :year
|
56
|
+
datetime:
|
57
|
+
distance_in_words:
|
58
|
+
about_x_hours:
|
59
|
+
one: etwa eine Stunde
|
60
|
+
other: etwa %{count} Stunden
|
61
|
+
about_x_months:
|
62
|
+
one: etwa ein Monat
|
63
|
+
other: etwa %{count} Monate
|
64
|
+
about_x_years:
|
65
|
+
one: etwa ein Jahr
|
66
|
+
other: etwa %{count} Jahre
|
67
|
+
almost_x_years:
|
68
|
+
one: fast ein Jahr
|
69
|
+
other: fast %{count} Jahre
|
70
|
+
half_a_minute: eine halbe Minute
|
71
|
+
less_than_x_minutes:
|
72
|
+
one: weniger als eine Minute
|
73
|
+
other: weniger als %{count} Minuten
|
74
|
+
less_than_x_seconds:
|
75
|
+
one: weniger als eine Sekunde
|
76
|
+
other: weniger als %{count} Sekunden
|
77
|
+
over_x_years:
|
78
|
+
one: mehr als ein Jahr
|
79
|
+
other: mehr als %{count} Jahre
|
80
|
+
x_days:
|
81
|
+
one: ein Tag
|
82
|
+
other: ! '%{count} Tage'
|
83
|
+
x_minutes:
|
84
|
+
one: eine Minute
|
85
|
+
other: ! '%{count} Minuten'
|
86
|
+
x_months:
|
87
|
+
one: ein Monat
|
88
|
+
other: ! '%{count} Monate'
|
89
|
+
x_seconds:
|
90
|
+
one: eine Sekunde
|
91
|
+
other: ! '%{count} Sekunden'
|
92
|
+
prompts:
|
93
|
+
day: Tag
|
94
|
+
hour: Stunden
|
95
|
+
minute: Minuten
|
96
|
+
month: Monat
|
97
|
+
second: Sekunden
|
98
|
+
year: Jahr
|
99
|
+
errors: &errors
|
100
|
+
format: ! '%{attribute} %{message}'
|
101
|
+
messages:
|
102
|
+
accepted: muss akzeptiert werden
|
103
|
+
blank: muss ausgefüllt werden
|
104
|
+
confirmation: stimmt nicht mit der Bestätigung überein
|
105
|
+
empty: muss ausgefüllt werden
|
106
|
+
equal_to: muss genau %{count} sein
|
107
|
+
even: muss gerade sein
|
108
|
+
exclusion: ist nicht verfügbar
|
109
|
+
greater_than: muss größer als %{count} sein
|
110
|
+
greater_than_or_equal_to: muss größer oder gleich %{count} sein
|
111
|
+
inclusion: ist kein gültiger Wert
|
112
|
+
invalid: ist nicht gültig
|
113
|
+
less_than: muss kleiner als %{count} sein
|
114
|
+
less_than_or_equal_to: muss kleiner oder gleich %{count} sein
|
115
|
+
not_a_number: ist keine Zahl
|
116
|
+
not_an_integer: muss ganzzahlig sein
|
117
|
+
odd: muss ungerade sein
|
118
|
+
record_invalid: ! 'Gültigkeitsprüfung ist fehlgeschlagen: %{errors}'
|
119
|
+
taken: ist bereits vergeben
|
120
|
+
too_long: ist zu lang (mehr als %{count} Zeichen)
|
121
|
+
too_short: ist zu kurz (weniger als %{count} Zeichen)
|
122
|
+
wrong_length: hat die falsche Länge (muss genau %{count} Zeichen haben)
|
123
|
+
template:
|
124
|
+
body: ! 'Bitte überprüfen Sie die folgenden Felder:'
|
125
|
+
header:
|
126
|
+
one: ! 'Konnte %{model} nicht speichern: ein Fehler.'
|
127
|
+
other: ! 'Konnte %{model} nicht speichern: %{count} Fehler.'
|
128
|
+
helpers:
|
129
|
+
select:
|
130
|
+
prompt: Bitte wählen
|
131
|
+
submit:
|
132
|
+
create: ! '%{model} erstellen'
|
133
|
+
submit: ! '%{model} speichern'
|
134
|
+
update: ! '%{model} aktualisieren'
|
135
|
+
number:
|
136
|
+
currency:
|
137
|
+
format:
|
138
|
+
delimiter: .
|
139
|
+
format: ! '%n %u'
|
140
|
+
precision: 2
|
141
|
+
separator: ! ','
|
142
|
+
significant: false
|
143
|
+
strip_insignificant_zeros: false
|
144
|
+
unit: €
|
145
|
+
format:
|
146
|
+
delimiter: .
|
147
|
+
precision: 2
|
148
|
+
separator: ! ','
|
149
|
+
significant: false
|
150
|
+
strip_insignificant_zeros: false
|
151
|
+
human:
|
152
|
+
decimal_units:
|
153
|
+
format: ! '%n %u'
|
154
|
+
units:
|
155
|
+
billion:
|
156
|
+
one: Milliarde
|
157
|
+
other: Milliarden
|
158
|
+
million: Millionen
|
159
|
+
quadrillion:
|
160
|
+
one: Billiarde
|
161
|
+
other: Billiarden
|
162
|
+
thousand: Tausend
|
163
|
+
trillion: Billionen
|
164
|
+
unit: ''
|
165
|
+
format:
|
166
|
+
delimiter: ''
|
167
|
+
precision: 1
|
168
|
+
significant: true
|
169
|
+
strip_insignificant_zeros: true
|
170
|
+
storage_units:
|
171
|
+
format: ! '%n %u'
|
172
|
+
units:
|
173
|
+
byte:
|
174
|
+
one: Byte
|
175
|
+
other: Bytes
|
176
|
+
gb: GB
|
177
|
+
kb: KB
|
178
|
+
mb: MB
|
179
|
+
tb: TB
|
180
|
+
percentage:
|
181
|
+
format:
|
182
|
+
delimiter: ''
|
183
|
+
precision:
|
184
|
+
format:
|
185
|
+
delimiter: ''
|
186
|
+
support:
|
187
|
+
array:
|
188
|
+
last_word_connector: ! ' und '
|
189
|
+
two_words_connector: ! ' und '
|
190
|
+
words_connector: ! ', '
|
191
|
+
time:
|
192
|
+
am: vormittags
|
193
|
+
formats:
|
194
|
+
default: ! '%A, %d. %B %Y, %H:%M Uhr'
|
195
|
+
long: ! '%A, %d. %B %Y, %H:%M Uhr'
|
196
|
+
short: ! '%d. %B, %H:%M Uhr'
|
197
|
+
pm: nachmittags
|
198
|
+
# remove these aliases after 'activemodel' and 'activerecord' namespaces are removed from Rails repository
|
199
|
+
activemodel:
|
200
|
+
errors:
|
201
|
+
<<: *errors
|
202
|
+
activerecord:
|
203
|
+
errors:
|
204
|
+
<<: *errors
|
@@ -0,0 +1,72 @@
|
|
1
|
+
jQuery ->
|
2
|
+
|
3
|
+
$(".tip").popover(placement: 'top auto')
|
4
|
+
|
5
|
+
$(".tip").on 'click', (event) ->
|
6
|
+
event.preventDefault()
|
7
|
+
|
8
|
+
$(".action_hint").tooltip(placement: 'top auto')
|
9
|
+
|
10
|
+
$('.tab_box a').click (e) ->
|
11
|
+
e.preventDefault()
|
12
|
+
$(this).tab('show')
|
13
|
+
|
14
|
+
bind_remove_links = ->
|
15
|
+
$('.nested_form_remove_link').click (e) ->
|
16
|
+
e.preventDefault()
|
17
|
+
$(this).closest(".nested_form").find(".nested_form_destroy").val("1")
|
18
|
+
$(this).closest(".nested_form").collapse('hide')
|
19
|
+
|
20
|
+
bind_remove_links()
|
21
|
+
|
22
|
+
$('.nested_form_add_link').click (e) ->
|
23
|
+
e.preventDefault()
|
24
|
+
new_id = new Date().getTime()
|
25
|
+
regexp = new RegExp("new_association", "g")
|
26
|
+
html = $(this).data('content').replace(regexp, new_id)
|
27
|
+
$(".nested_forms").append(html)
|
28
|
+
bind_remove_links()
|
29
|
+
|
30
|
+
$('.nested_form_polymorphic_add_link').click (e) ->
|
31
|
+
e.preventDefault()
|
32
|
+
object_class = $('#add_link_class').children('option:selected').val()
|
33
|
+
if object_class != ''
|
34
|
+
data = $(this).data('content')
|
35
|
+
new_id = new Date().getTime()
|
36
|
+
regexp = new RegExp("new_association", "g")
|
37
|
+
html = data[object_class].replace(regexp, new_id)
|
38
|
+
$(".nested_forms").append(html)
|
39
|
+
bind_remove_links()
|
40
|
+
|
41
|
+
$('.polymorphic_add_link').click (e) ->
|
42
|
+
e.preventDefault()
|
43
|
+
object_class = $('#add_link_class').children('option:selected').val()
|
44
|
+
if object_class != ''
|
45
|
+
location.href = "#{$(this).attr('href')}?type=#{object_class}"
|
46
|
+
|
47
|
+
$('.jstree').each ->
|
48
|
+
params =
|
49
|
+
"core":
|
50
|
+
"data": $(this).data('content')
|
51
|
+
"themes":
|
52
|
+
"dots": false
|
53
|
+
"plugins": []
|
54
|
+
if $(this).data('sortable')
|
55
|
+
params["core"]["check_callback"] = true
|
56
|
+
params["plugins"].push "dnd"
|
57
|
+
tree = $(this).jstree params
|
58
|
+
tree.on "select_node.jstree", (e, data) ->
|
59
|
+
location.href = data.node.a_attr.href
|
60
|
+
if $(this).data('sortable')
|
61
|
+
tree.on "move_node.jstree", (e, data) ->
|
62
|
+
$(tree).siblings('.alert').remove()
|
63
|
+
$.ajax
|
64
|
+
async: false,
|
65
|
+
type: 'post',
|
66
|
+
url: "#{data.node.a_attr.href}/move.json"
|
67
|
+
data:
|
68
|
+
"parent": if data.parent != '#' then data.parent else ''
|
69
|
+
"position": data.position
|
70
|
+
error: (data) ->
|
71
|
+
tree.jstree('refresh')
|
72
|
+
$(tree).before("<div class=\"alert alert-danger\">#{data.responseText}</div>")
|