cambium 0.3.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.txt +1 -1
- data/README.md +339 -15
- data/{lib/generators/cambium/templates/app/assets/javascripts/admin/admin.js.coffee → app/assets/javascripts/cambium/admin/application.js.coffee} +4 -10
- data/app/assets/javascripts/cambium/admin/routers/router.js.coffee +25 -0
- data/app/assets/javascripts/cambium/admin/users.js +2 -0
- data/app/assets/javascripts/cambium/admin/views/dropdown_menu.js.coffee +24 -0
- data/app/assets/javascripts/cambium/admin/views/pickadate.js.coffee +15 -0
- data/app/assets/stylesheets/cambium/admin/application.scss +27 -0
- data/{lib/generators/cambium/templates/app/assets/stylesheets → app/assets/stylesheets/cambium}/admin/bones/bones-config/_colors.scss +7 -7
- data/{lib/generators/cambium/templates/app/assets/stylesheets → app/assets/stylesheets/cambium}/admin/bones/bones.scss +18 -18
- data/app/assets/stylesheets/cambium/admin/partials/_globals.scss +21 -0
- data/app/assets/stylesheets/cambium/admin/partials/activity.scss +52 -0
- data/app/assets/stylesheets/cambium/admin/partials/components.scss +64 -0
- data/app/assets/stylesheets/cambium/admin/partials/dashboard.scss +48 -0
- data/app/assets/stylesheets/cambium/admin/partials/forms.scss +107 -0
- data/app/assets/stylesheets/cambium/admin/partials/header.scss +113 -0
- data/app/assets/stylesheets/cambium/admin/partials/page_title.scss +42 -0
- data/app/assets/stylesheets/cambium/admin/partials/sidebar.scss +41 -0
- data/app/assets/stylesheets/cambium/admin/partials/tables.scss +80 -0
- data/app/assets/stylesheets/cambium/admin/partials/typography.scss +5 -0
- data/app/assets/stylesheets/cambium/admin/partials/wireframe.scss +52 -0
- data/app/assets/stylesheets/cambium/admin/users.css +4 -0
- data/app/controllers/cambium/admin/dashboard_controller.rb +12 -0
- data/app/controllers/cambium/admin/search_controller.rb +9 -0
- data/app/controllers/cambium/admin/users_controller.rb +30 -0
- data/app/controllers/cambium/admin_controller.rb +90 -0
- data/app/helpers/cambium/cambium_helper.rb +205 -0
- data/app/presenters/cambium/admin_presenter.rb +127 -0
- data/app/views/cambium/admin/_activity.html.erb +6 -0
- data/app/views/cambium/admin/_header.html.erb +41 -0
- data/app/views/cambium/admin/_sidebar.html.erb +19 -0
- data/app/views/cambium/admin/_status.html.erb +5 -0
- data/app/views/cambium/admin/dashboard/show.html.erb +5 -0
- data/app/views/cambium/admin/edit.html.erb +7 -0
- data/app/views/cambium/admin/index.html.erb +7 -0
- data/app/views/cambium/admin/new.html.erb +7 -0
- data/app/views/cambium/admin/paper_trail/versions/_version.html.erb +20 -0
- data/app/views/cambium/admin/search/index.html.erb +38 -0
- data/app/views/layouts/admin.html.erb +25 -0
- data/bin/rails +12 -0
- data/cambium.gemspec +19 -15
- data/config/routes.rb +10 -0
- data/lib/cambium/configuration.rb +28 -0
- data/lib/cambium/engine.rb +2 -1
- data/lib/cambium/version.rb +1 -1
- data/lib/cambium.rb +12 -1
- data/lib/generators/cambium/admin_generator.rb +104 -0
- data/lib/generators/cambium/app_generator.rb +205 -0
- data/lib/generators/cambium/controller_generator.rb +81 -0
- data/lib/generators/cambium/gemfile_generator.rb +36 -0
- data/lib/generators/cambium/install_generator.rb +19 -0
- data/lib/generators/cambium/user_generator.rb +40 -0
- data/lib/generators/{cambium/helpers → helpers}/generators_helper.rb +32 -24
- data/lib/generators/templates/Gemfile.erb +79 -0
- data/lib/generators/{cambium/templates/app/assets/javascripts/backbone/app.js.coffee → templates/app/assets/javascripts/application.js.coffee} +9 -1
- data/lib/generators/templates/app/assets/javascripts/views/default_helpers.js.coffee +16 -0
- data/lib/generators/templates/app/assets/stylesheets/admin/admin.scss +3 -0
- data/lib/generators/templates/app/controllers/admin/controller.rb.erb +2 -0
- data/lib/generators/{cambium/templates → templates}/app/controllers/application_controller.rb +1 -5
- data/lib/generators/{cambium/templates → templates}/app/models/user.rb +4 -4
- data/lib/generators/templates/app/views/application/_status.html.erb +3 -0
- data/lib/generators/{cambium/templates → templates}/app/views/layouts/application.html.erb +1 -1
- data/lib/generators/templates/config/admin/controller.yml.erb +24 -0
- data/lib/generators/templates/config/admin/sidebar.yml +9 -0
- data/lib/generators/templates/config/admin/users.yml +31 -0
- data/lib/generators/{cambium/templates → templates}/config/application.rb +6 -4
- data/lib/generators/templates/config/initializers/_hash.rb +23 -0
- data/lib/generators/templates/config/initializers/_settings.rb +18 -0
- data/lib/generators/templates/config/initializers/assets.rb +1 -0
- data/lib/generators/templates/config/initializers/cambium.rb +16 -0
- data/lib/generators/templates/config/private.yml +16 -0
- data/lib/generators/templates/config/routes.rb +54 -0
- data/lib/generators/templates/config/settings.yml +16 -0
- data/lib/generators/{cambium/templates → templates}/gitignore +1 -1
- data/lib/help/cambium_prereqs.txt +13 -0
- data/lib/help/pg_search_post_install.txt +13 -0
- data/lib/{generators/cambium/templates/lib/tasks → tasks}/db.rake +2 -2
- data/lib/{generators/cambium/templates/lib/tasks → tasks}/rename.rake +1 -1
- data/test/controllers/cambium/admin/dashboard_controller_test.rb +9 -0
- data/test/controllers/cambium/admin/users_controller_test.rb +9 -0
- data/test/controllers/cambium/admin_controller_test.rb +9 -0
- metadata +192 -152
- data/bin/cambium +0 -16
- data/lib/generators/cambium/helpers/dependencies_helper.rb +0 -58
- data/lib/generators/cambium/install/admin_generator.rb +0 -110
- data/lib/generators/cambium/install/app_generator.rb +0 -162
- data/lib/generators/cambium/install/config_generator.rb +0 -182
- data/lib/generators/cambium/install/utilities_generator.rb +0 -57
- data/lib/generators/cambium/model/image_generator.rb +0 -67
- data/lib/generators/cambium/model/page_generator.rb +0 -131
- data/lib/generators/cambium/model/post_generator.rb +0 -71
- data/lib/generators/cambium/model/tag_generator.rb +0 -40
- data/lib/generators/cambium/model/user_generator.rb +0 -78
- data/lib/generators/cambium/templates/Gemfile +0 -43
- data/lib/generators/cambium/templates/Gemfile.erb +0 -40
- data/lib/generators/cambium/templates/_partials/pages/admin_icon.rb +0 -6
- data/lib/generators/cambium/templates/app/assets/javascripts/.DS_Store +0 -0
- data/lib/generators/cambium/templates/app/assets/javascripts/admin/collections/.gitkeep +0 -0
- data/lib/generators/cambium/templates/app/assets/javascripts/admin/models/.gitkeep +0 -0
- data/lib/generators/cambium/templates/app/assets/javascripts/admin/models/image.js.coffee +0 -14
- data/lib/generators/cambium/templates/app/assets/javascripts/admin/models/tag.js.coffee +0 -14
- data/lib/generators/cambium/templates/app/assets/javascripts/admin/parser_rules/custom.js +0 -552
- data/lib/generators/cambium/templates/app/assets/javascripts/admin/routers/router.js.coffee +0 -37
- data/lib/generators/cambium/templates/app/assets/javascripts/admin/tag.jst.ejs +0 -7
- data/lib/generators/cambium/templates/app/assets/javascripts/admin/templates/image.jst.ejs +0 -3
- data/lib/generators/cambium/templates/app/assets/javascripts/admin/templates/paginator_controls.jst.ejs +0 -8
- data/lib/generators/cambium/templates/app/assets/javascripts/admin/templates/paginator_nav.jst.ejs +0 -11
- data/lib/generators/cambium/templates/app/assets/javascripts/admin/templates/post_tag.jst.ejs +0 -1
- data/lib/generators/cambium/templates/app/assets/javascripts/admin/views/accordion.js.coffee +0 -33
- data/lib/generators/cambium/templates/app/assets/javascripts/admin/views/counter.js.coffee +0 -25
- data/lib/generators/cambium/templates/app/assets/javascripts/admin/views/dropdown_toggle.js.coffee +0 -16
- data/lib/generators/cambium/templates/app/assets/javascripts/admin/views/image_upload.js.coffee +0 -28
- data/lib/generators/cambium/templates/app/assets/javascripts/admin/views/init_counter.js.coffee +0 -13
- data/lib/generators/cambium/templates/app/assets/javascripts/admin/views/paginator.js.coffee +0 -86
- data/lib/generators/cambium/templates/app/assets/javascripts/admin/views/publishable.js.coffee +0 -12
- data/lib/generators/cambium/templates/app/assets/javascripts/admin/views/tags.js.coffee +0 -158
- data/lib/generators/cambium/templates/app/assets/javascripts/admin/views/wysiwyg.js.coffee +0 -87
- data/lib/generators/cambium/templates/app/assets/javascripts/admin/wysihtml5.js +0 -9521
- data/lib/generators/cambium/templates/app/assets/javascripts/application.js +0 -10
- data/lib/generators/cambium/templates/app/assets/javascripts/backbone/templates/.keep +0 -0
- data/lib/generators/cambium/templates/app/assets/stylesheets/admin/admin.scss +0 -14
- data/lib/generators/cambium/templates/app/assets/stylesheets/admin/partials/_content.scss +0 -88
- data/lib/generators/cambium/templates/app/assets/stylesheets/admin/partials/_form.scss +0 -470
- data/lib/generators/cambium/templates/app/assets/stylesheets/admin/partials/_globals.scss +0 -39
- data/lib/generators/cambium/templates/app/assets/stylesheets/admin/partials/_header.scss +0 -121
- data/lib/generators/cambium/templates/app/assets/stylesheets/admin/partials/_nav.scss +0 -45
- data/lib/generators/cambium/templates/app/assets/stylesheets/admin/partials/_wireframe.scss +0 -24
- data/lib/generators/cambium/templates/app/assets/stylesheets/admin/wysihtml5.css +0 -7
- data/lib/generators/cambium/templates/app/controllers/admin/images_controller.rb +0 -45
- data/lib/generators/cambium/templates/app/controllers/admin/pages_controller.rb +0 -42
- data/lib/generators/cambium/templates/app/controllers/admin/posts_controller.rb +0 -39
- data/lib/generators/cambium/templates/app/controllers/admin/taggings_controller.rb +0 -69
- data/lib/generators/cambium/templates/app/controllers/admin/tags_controller.rb +0 -11
- data/lib/generators/cambium/templates/app/controllers/admin/users_controller.rb +0 -13
- data/lib/generators/cambium/templates/app/controllers/admin_controller.rb +0 -97
- data/lib/generators/cambium/templates/app/controllers/images_controller.rb +0 -45
- data/lib/generators/cambium/templates/app/controllers/pages_controller.rb +0 -12
- data/lib/generators/cambium/templates/app/controllers/posts_controller.rb +0 -11
- data/lib/generators/cambium/templates/app/helpers/admin/pages_controller.rb +0 -47
- data/lib/generators/cambium/templates/app/helpers/admin_helper.rb +0 -121
- data/lib/generators/cambium/templates/app/models/concerns/name.rb +0 -7
- data/lib/generators/cambium/templates/app/models/concerns/title.rb +0 -7
- data/lib/generators/cambium/templates/app/models/image.rb +0 -43
- data/lib/generators/cambium/templates/app/models/page.rb +0 -81
- data/lib/generators/cambium/templates/app/models/post.rb +0 -45
- data/lib/generators/cambium/templates/app/models/tag.rb +0 -33
- data/lib/generators/cambium/templates/app/models/tagging.rb +0 -20
- data/lib/generators/cambium/templates/app/uploaders/image_uploader.rb +0 -91
- data/lib/generators/cambium/templates/app/views/admin/_buttons.html.erb +0 -5
- data/lib/generators/cambium/templates/app/views/admin/_form.html.erb +0 -11
- data/lib/generators/cambium/templates/app/views/admin/_title.html.erb +0 -1
- data/lib/generators/cambium/templates/app/views/admin/edit.html.erb +0 -2
- data/lib/generators/cambium/templates/app/views/admin/images/_image.html.erb +0 -1
- data/lib/generators/cambium/templates/app/views/admin/images/create.js.erb +0 -7
- data/lib/generators/cambium/templates/app/views/admin/images/index.json.jbuilder +0 -4
- data/lib/generators/cambium/templates/app/views/admin/index.html.erb +0 -50
- data/lib/generators/cambium/templates/app/views/admin/new.html.erb +0 -2
- data/lib/generators/cambium/templates/app/views/admin/pages/_form.html.erb +0 -26
- data/lib/generators/cambium/templates/app/views/admin/posts/_form.html.erb +0 -40
- data/lib/generators/cambium/templates/app/views/admin/shared/_footer.html.erb +0 -2
- data/lib/generators/cambium/templates/app/views/admin/shared/_header.html.erb +0 -2
- data/lib/generators/cambium/templates/app/views/admin/shared/_insert_image.html.erb +0 -12
- data/lib/generators/cambium/templates/app/views/admin/shared/_nav.html.erb +0 -12
- data/lib/generators/cambium/templates/app/views/admin/shared/_status.html.erb +0 -3
- data/lib/generators/cambium/templates/app/views/admin/shared/forms/_editor.html.erb +0 -54
- data/lib/generators/cambium/templates/app/views/admin/shared/forms/_form_column_left.html.erb +0 -9
- data/lib/generators/cambium/templates/app/views/admin/shared/forms/_form_column_right.html.erb +0 -9
- data/lib/generators/cambium/templates/app/views/admin/shared/forms/_form_page.html.erb +0 -22
- data/lib/generators/cambium/templates/app/views/admin/shared/forms/_form_section.html.erb +0 -8
- data/lib/generators/cambium/templates/app/views/admin/shared/forms/_publishable.html.erb +0 -33
- data/lib/generators/cambium/templates/app/views/admin/users/_form.html.erb +0 -11
- data/lib/generators/cambium/templates/app/views/application/_status.html.erb +0 -3
- data/lib/generators/cambium/templates/app/views/layouts/.DS_Store +0 -0
- data/lib/generators/cambium/templates/app/views/layouts/admin.html.erb +0 -44
- data/lib/generators/cambium/templates/app/views/page_templates/default.html.erb +0 -2
- data/lib/generators/cambium/templates/app/views/posts/_post.html.erb +0 -4
- data/lib/generators/cambium/templates/app/views/posts/index.html.erb +0 -1
- data/lib/generators/cambium/templates/app/views/posts/show.html.erb +0 -10
- data/lib/generators/cambium/templates/config/app_routes.rb +0 -77
- data/lib/generators/cambium/templates/config/database.mysql2.yml.erb +0 -15
- data/lib/generators/cambium/templates/config/database.pg.yml.erb +0 -14
- data/lib/generators/cambium/templates/config/database.sqlite3.yml.erb +0 -18
- data/lib/generators/cambium/templates/config/initializers/_settings.rb +0 -11
- data/lib/generators/cambium/templates/config/initializers/assets.rb +0 -1
- data/lib/generators/cambium/templates/config/routes.rb.erb +0 -42
- data/lib/generators/cambium/templates/config/settings.yml +0 -15
- data/lib/generators/cambium/templates/config/settings_private.sample.yml +0 -15
- data/lib/generators/cambium/templates/config/settings_private.yml +0 -13
- data/lib/generators/cambium/templates/db/migrate/create_pages.rb.erb +0 -24
- data/lib/generators/cambium/templates/db/migrate/create_posts.rb +0 -19
- data/lib/generators/cambium/templates/lib/.DS_Store +0 -0
- data/lib/help/cambium +0 -7
- /data/{lib/generators/cambium/templates/app/assets/javascripts/backbone/collections → app/assets/javascripts/cambium/admin/templates}/.keep +0 -0
- /data/{lib/generators/cambium/templates/app/assets/javascripts/backbone → app/assets/javascripts/cambium/admin}/views/default_helpers.js.coffee +0 -0
- /data/{lib/generators/cambium/templates/app/assets/stylesheets → app/assets/stylesheets/cambium}/admin/bones/bones-config/__default.scss +0 -0
- /data/{lib/generators/cambium/templates/app/assets/stylesheets → app/assets/stylesheets/cambium}/admin/bones/bones-config/_buttons.scss +0 -0
- /data/{lib/generators/cambium/templates/app/assets/stylesheets → app/assets/stylesheets/cambium}/admin/bones/bones-config/_components.scss +0 -0
- /data/{lib/generators/cambium/templates/app/assets/stylesheets → app/assets/stylesheets/cambium}/admin/bones/bones-config/_forms.scss +0 -0
- /data/{lib/generators/cambium/templates/app/assets/stylesheets → app/assets/stylesheets/cambium}/admin/bones/bones-config/_helpers.scss +0 -0
- /data/{lib/generators/cambium/templates/app/assets/stylesheets → app/assets/stylesheets/cambium}/admin/bones/bones-config/_images.scss +0 -0
- /data/{lib/generators/cambium/templates/app/assets/stylesheets → app/assets/stylesheets/cambium}/admin/bones/bones-config/_nav.scss +0 -0
- /data/{lib/generators/cambium/templates/app/assets/stylesheets → app/assets/stylesheets/cambium}/admin/bones/bones-config/_tables.scss +0 -0
- /data/{lib/generators/cambium/templates/app/assets/stylesheets → app/assets/stylesheets/cambium}/admin/bones/bones-config/_typography.scss +0 -0
- /data/{lib/generators/cambium/templates/app/assets/stylesheets → app/assets/stylesheets/cambium}/admin/bones/bones-config/_wireframe.scss +0 -0
- /data/{lib/generators/cambium/templates/app → app}/models/concerns/idx.rb +0 -0
- /data/{lib/generators/cambium/templates/app → app}/models/concerns/image_cropper.rb +0 -0
- /data/{lib/generators/cambium/templates/app → app}/models/concerns/publishable.rb +0 -0
- /data/{lib/generators/cambium/templates/app → app}/models/concerns/slug.rb +0 -0
- /data/{lib/generators/cambium/templates/app → app}/models/concerns/tags.rb +0 -0
- /data/lib/generators/{cambium/helpers → helpers}/_autoloader.rb +0 -0
- /data/lib/generators/{cambium/templates/app/assets/javascripts/backbone → templates/app/assets/javascripts}/routers/router.js.coffee +0 -0
- /data/lib/generators/{cambium/templates/app/assets/javascripts/backbone/models → templates/app/assets/javascripts/templates}/.keep +0 -0
- /data/lib/generators/{cambium/templates → templates}/app/assets/stylesheets/application.scss +0 -0
- /data/lib/generators/{cambium/templates → templates}/app/views/home/index.html.erb +0 -0
- /data/lib/generators/{cambium/templates → templates}/db/seeds.rb +0 -0
- /data/{lib/generators/cambium/templates/vendor → vendor}/assets/javascripts/modernizr.js +0 -0
- /data/{lib/generators/cambium/templates/vendor → vendor}/assets/stylesheets/normalize.scss +0 -0
data/lib/generators/cambium/templates/app/assets/javascripts/admin/views/dropdown_toggle.js.coffee
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
class Admin.Views.DropdownToggle extends Backbone.View
|
2
|
-
|
3
|
-
el: '.dropdown-toggle'
|
4
|
-
|
5
|
-
events:
|
6
|
-
'click .trigger': 'initClick'
|
7
|
-
|
8
|
-
initClick: (e) =>
|
9
|
-
e.preventDefault()
|
10
|
-
if $(e.target).hasClass('trigger')
|
11
|
-
trigger = $(e.target)
|
12
|
-
else
|
13
|
-
trigger = $(e.target).parents('.trigger')
|
14
|
-
trigger.toggleClass('active')
|
15
|
-
trigger.children('i').toggleClass('icon-arrow-down icon-arrow-up')
|
16
|
-
trigger.siblings('ul').toggle()
|
data/lib/generators/cambium/templates/app/assets/javascripts/admin/views/image_upload.js.coffee
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
class Admin.Views.ImageUpload extends Backbone.View
|
2
|
-
|
3
|
-
el: "body"
|
4
|
-
|
5
|
-
# events:
|
6
|
-
# "click form.edit_project input[type=submit]": "submitForm"
|
7
|
-
|
8
|
-
initialize: (options) =>
|
9
|
-
@model = options.model
|
10
|
-
$("form.edit_#{@model} input[type=submit]").click @submitForm
|
11
|
-
$("#image_filename").attr "name", "image[filename]"
|
12
|
-
$(".images-container").after ->
|
13
|
-
$("#new_image").clone()
|
14
|
-
$(".new_image").last().remove()
|
15
|
-
$("#new_image").fileupload
|
16
|
-
add: (e,data) ->
|
17
|
-
$(".images-container").append """
|
18
|
-
<div class="loading">Uploading #{data.files[0].name}...</div>
|
19
|
-
"""
|
20
|
-
data.submit()
|
21
|
-
complete: (e,data) ->
|
22
|
-
$(".images-container div.loading").first().remove()
|
23
|
-
$(".images-container div.loading").insertAfter( $(".images-container img").last() )
|
24
|
-
|
25
|
-
submitForm: (e) =>
|
26
|
-
e.preventDefault()
|
27
|
-
$("#new_image").remove()
|
28
|
-
$("form.edit_#{@model}").submit()
|
data/lib/generators/cambium/templates/app/assets/javascripts/admin/views/init_counter.js.coffee
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
class Admin.Views.InitCounter extends Backbone.View
|
2
|
-
|
3
|
-
el: 'form'
|
4
|
-
|
5
|
-
initialize: =>
|
6
|
-
@findMaxLengths()
|
7
|
-
|
8
|
-
findMaxLengths: =>
|
9
|
-
for input in $('input')
|
10
|
-
if $(input).attr('maxlength')?
|
11
|
-
new Admin.Views.Counter
|
12
|
-
target: $(input).attr('id')
|
13
|
-
max: $(input).attr('maxlength')
|
data/lib/generators/cambium/templates/app/assets/javascripts/admin/views/paginator.js.coffee
DELETED
@@ -1,86 +0,0 @@
|
|
1
|
-
class Admin.Views.Paginator extends Backbone.View
|
2
|
-
|
3
|
-
el: 'table'
|
4
|
-
group: 15
|
5
|
-
current: 1
|
6
|
-
next: 2
|
7
|
-
|
8
|
-
controls: JST['admin/backbone/templates/paginator_controls']
|
9
|
-
paginav: JST['admin/backbone/templates/paginator_nav']
|
10
|
-
|
11
|
-
initialize: =>
|
12
|
-
@setup()
|
13
|
-
@bindEvents()
|
14
|
-
|
15
|
-
setup: =>
|
16
|
-
for submission, i in $('tbody tr') by @group
|
17
|
-
$('tbody tr').slice(i, i + @group).attr('data-group', Math.floor(i / @group) + 1)
|
18
|
-
$("tbody tr[data-group='1']").show()
|
19
|
-
@max = $('tbody tr').last().data('group')
|
20
|
-
@prev = @max
|
21
|
-
if $("tbody tr[data-group='2']").length > 0
|
22
|
-
$(@el).before @controls
|
23
|
-
$(@el).after @paginav
|
24
|
-
$('.paginav .total').html @max
|
25
|
-
$(@el).addClass('active')
|
26
|
-
|
27
|
-
bindEvents: =>
|
28
|
-
@previousButton = $('.controls .prev').first()
|
29
|
-
@previousButton.hide()
|
30
|
-
@nextButton = $('.controls .next').first()
|
31
|
-
@previousButton.click (e) =>
|
32
|
-
e.preventDefault()
|
33
|
-
@goBack()
|
34
|
-
@nextButton.click (e) =>
|
35
|
-
e.preventDefault()
|
36
|
-
@goForward()
|
37
|
-
if $("tbody tr[data-group='2']").length > 0
|
38
|
-
$('#jump-to').click (e) =>
|
39
|
-
e.preventDefault()
|
40
|
-
page = $('#jump-to-val').val()
|
41
|
-
@jumpTo(page) if page != '' and page <= @max
|
42
|
-
$('#jump-to-val').keyup (e) =>
|
43
|
-
e.preventDefault()
|
44
|
-
$("#jump-to").click() if e.keyCode == 13
|
45
|
-
|
46
|
-
goForward: =>
|
47
|
-
$("tbody tr[data-group='#{@current}']").hide()
|
48
|
-
$("tbody tr[data-group='#{@next}']").show()
|
49
|
-
@prev = @current
|
50
|
-
@current = @next
|
51
|
-
if @next == @max
|
52
|
-
@next = 1
|
53
|
-
else
|
54
|
-
@next++
|
55
|
-
@updatePaginav()
|
56
|
-
|
57
|
-
goBack: =>
|
58
|
-
$("tbody tr[data-group='#{@current}']").hide()
|
59
|
-
$("tbody tr[data-group='#{@prev}']").show()
|
60
|
-
@next = @current
|
61
|
-
@current = @prev
|
62
|
-
if @prev == 1
|
63
|
-
@prev = @max
|
64
|
-
else
|
65
|
-
@prev--
|
66
|
-
@updatePaginav()
|
67
|
-
|
68
|
-
updatePaginav: =>
|
69
|
-
$('.paginav .current').html @current
|
70
|
-
@previousButton.hide() if @current == 1
|
71
|
-
@previousButton.fadeIn() if @current == 2
|
72
|
-
@nextButton.hide() if @current == @max
|
73
|
-
@nextButton.fadeIn() if @next == @max
|
74
|
-
|
75
|
-
jumpTo: (page) =>
|
76
|
-
$('#jump-to-val').val('')
|
77
|
-
$("tbody tr[data-group='#{@current}']").hide()
|
78
|
-
$("tbody tr[data-group='#{page}']").show()
|
79
|
-
@current = page
|
80
|
-
if @current == @max
|
81
|
-
@next = 1
|
82
|
-
@prev = @current - 1
|
83
|
-
else if @current == 1
|
84
|
-
@prev = @max
|
85
|
-
@next = 2
|
86
|
-
@updatePaginav()
|
data/lib/generators/cambium/templates/app/assets/javascripts/admin/views/publishable.js.coffee
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
class Admin.Views.Publishable extends Backbone.View
|
2
|
-
|
3
|
-
el: 'body'
|
4
|
-
|
5
|
-
initialize: =>
|
6
|
-
@setupPickadate()
|
7
|
-
|
8
|
-
setupPickadate: =>
|
9
|
-
$('.active-date').pickadate()
|
10
|
-
$('.inactive-date').pickadate()
|
11
|
-
$('.active-time').pickatime()
|
12
|
-
$('.inactive-time').pickatime()
|
@@ -1,158 +0,0 @@
|
|
1
|
-
class Admin.Views.Tags extends Backbone.View
|
2
|
-
|
3
|
-
el: "#tag-container"
|
4
|
-
|
5
|
-
dup: false
|
6
|
-
active: 0
|
7
|
-
|
8
|
-
template: JST['admin/templates/tag']
|
9
|
-
|
10
|
-
events:
|
11
|
-
"keyup #new-tag-title": "keyController"
|
12
|
-
"keydown #new-tag-title": "checkEnter"
|
13
|
-
"click .delete-tag": "deleteTag"
|
14
|
-
"click a.autocomplete": "addAutocomplete"
|
15
|
-
|
16
|
-
# ------------------------------------------- init
|
17
|
-
|
18
|
-
initialize : (options) =>
|
19
|
-
@setOptions options
|
20
|
-
@collection = new Admin.Collections.Tags @url
|
21
|
-
@fetchTags()
|
22
|
-
$('body').click (e) =>
|
23
|
-
unless $(e.target).hasClass('deleteTag') or $(e.target).hasClass('autocomplete') or $(e.target).hasClass('new-tag-title')
|
24
|
-
$('ul.autocomplete').html ""
|
25
|
-
|
26
|
-
setOptions: (options) =>
|
27
|
-
if options.id
|
28
|
-
@url = options.url
|
29
|
-
@taggable = options.taggable
|
30
|
-
@taggable_id = options.id
|
31
|
-
|
32
|
-
# ------------------------------------------- get data
|
33
|
-
|
34
|
-
fetchTags: =>
|
35
|
-
@collection.fetch
|
36
|
-
success: (tags) =>
|
37
|
-
@tags = tags.toJSON()
|
38
|
-
@renderTags()
|
39
|
-
@getAllTags()
|
40
|
-
|
41
|
-
getAllTags: =>
|
42
|
-
$.ajax
|
43
|
-
url: "/admin/json/tags"
|
44
|
-
success: (data) =>
|
45
|
-
@allTags = new Array()
|
46
|
-
@currentTags = new Array()
|
47
|
-
@currentTags.push($(tag).html()) for tag in $('#tag-list li > span.title')
|
48
|
-
for tag in data
|
49
|
-
@allTags.push tag.name if @currentTags.indexOf(tag.name) is -1
|
50
|
-
|
51
|
-
# ------------------------------------------- render
|
52
|
-
|
53
|
-
renderTags: =>
|
54
|
-
$(".loading").html ""
|
55
|
-
$("#tag-list").html ""
|
56
|
-
_.each @tags, (tag) =>
|
57
|
-
@renderTag(tag) if `tag.title != undefined`
|
58
|
-
|
59
|
-
renderTag: (tag) =>
|
60
|
-
$('#tag-list').append @template
|
61
|
-
id: tag.id
|
62
|
-
tag_id: tag.tag_id
|
63
|
-
title: tag.title
|
64
|
-
|
65
|
-
# ------------------------------------------- events controller
|
66
|
-
|
67
|
-
keyController: (e) =>
|
68
|
-
e.preventDefault()
|
69
|
-
title = $(e.target).val()
|
70
|
-
if title == ""
|
71
|
-
@reset()
|
72
|
-
else
|
73
|
-
switch e.keyCode
|
74
|
-
# when 13 then @checkDuplicates(title) # Enter
|
75
|
-
when 38 # Up Arrow
|
76
|
-
if @active != 0
|
77
|
-
@active--
|
78
|
-
if @active == 0
|
79
|
-
$("#new-tag-title").val @origVal
|
80
|
-
else
|
81
|
-
@updateVal(title)
|
82
|
-
when 40 # Down Arrow
|
83
|
-
@origVal = title if @active == 0
|
84
|
-
@active++ if @active != @maxAutocomplete
|
85
|
-
@updateVal(title)
|
86
|
-
else
|
87
|
-
@autocomplete(title)
|
88
|
-
|
89
|
-
checkEnter: (e) =>
|
90
|
-
$('div.tagging-errors').html ""
|
91
|
-
if e.keyCode == 13
|
92
|
-
e.preventDefault()
|
93
|
-
@splitTitle( $(e.target).val() )
|
94
|
-
# @checkDuplicates( $(e.target).val() )
|
95
|
-
|
96
|
-
# ------------------------------------------- autocomplete
|
97
|
-
|
98
|
-
updateVal: (title) =>
|
99
|
-
$('ul.autocomplete li').removeClass "active"
|
100
|
-
$("li#arrow-#{@active}").addClass "active"
|
101
|
-
$("#new-tag-title").val( $("#arrow-#{@active} > a").html() )
|
102
|
-
|
103
|
-
reset: =>
|
104
|
-
@active = 0
|
105
|
-
$('#new-tag-title').val ""
|
106
|
-
$('ul.autocomplete').html ""
|
107
|
-
|
108
|
-
autocomplete: (title) =>
|
109
|
-
$('ul.autocomplete').html ""
|
110
|
-
if `title != ""`
|
111
|
-
arrow = 1
|
112
|
-
console.log @allTags
|
113
|
-
for tag in @allTags
|
114
|
-
if tag.toLowerCase().indexOf(title.toLowerCase()) > -1
|
115
|
-
$('ul.autocomplete').append "<li id=\"arrow-#{arrow}\"><a class=\"autocomplete\" href=\"#\">#{tag}</a></li>"
|
116
|
-
arrow++
|
117
|
-
@maxAutocomplete = arrow - 1
|
118
|
-
|
119
|
-
addAutocomplete: (e) =>
|
120
|
-
e.preventDefault()
|
121
|
-
title = $(e.target).html()
|
122
|
-
@newTag(title)
|
123
|
-
$('ul.autocomplete').html ""
|
124
|
-
|
125
|
-
splitTitle: (str) =>
|
126
|
-
titles = str.split(', ')
|
127
|
-
for t in titles
|
128
|
-
@checkDuplicates(t)
|
129
|
-
|
130
|
-
checkDuplicates: (title) =>
|
131
|
-
for li in $('#tag-list li')
|
132
|
-
@dup = true if title.toLowerCase() == $(li).data("title").toLowerCase()
|
133
|
-
if @dup is true
|
134
|
-
$('div.tagging-errors').append "You already have the tag: #{title}<br>"
|
135
|
-
# @reset()
|
136
|
-
@dup = false
|
137
|
-
else if `title != ""`
|
138
|
-
@newTag(title)
|
139
|
-
|
140
|
-
# ------------------------------------------- CRUD
|
141
|
-
|
142
|
-
newTag: (title) =>
|
143
|
-
model = new Admin.Models.Tag
|
144
|
-
tag_title: title
|
145
|
-
taggable: @taggable
|
146
|
-
taggable_id: @taggable_id
|
147
|
-
model.save null,
|
148
|
-
complete: (model, response) =>
|
149
|
-
@fetchTags()
|
150
|
-
@reset()
|
151
|
-
|
152
|
-
deleteTag: (e) =>
|
153
|
-
e.preventDefault()
|
154
|
-
id = $(e.target).parents('li').data('id')
|
155
|
-
model = @collection.get(id)
|
156
|
-
model.destroy()
|
157
|
-
$(e.target).parents('li').next('.separator').remove()
|
158
|
-
$(e.target).parents('li').remove()
|
@@ -1,87 +0,0 @@
|
|
1
|
-
class Admin.Views.Wysiwyg extends Backbone.View
|
2
|
-
|
3
|
-
el: 'body'
|
4
|
-
textarea: '.wysiwyg'
|
5
|
-
modal: '#wysihtml5-insert-image-modal'
|
6
|
-
imagesContainer: 'div.images-container'
|
7
|
-
|
8
|
-
imageTemplate: JST['admin/templates/image']
|
9
|
-
|
10
|
-
events:
|
11
|
-
'click a.browse-images': 'initInsertImage'
|
12
|
-
|
13
|
-
initialize: (options) =>
|
14
|
-
@initEditor(options)
|
15
|
-
options.image_upload = true if typeof(options.image_upload) == undefined
|
16
|
-
if options.image_upload == true
|
17
|
-
@renderInsertImageModal()
|
18
|
-
@collection = new Admin.Collections.Images options.url
|
19
|
-
@fetchImages()
|
20
|
-
@initImageUpload()
|
21
|
-
else
|
22
|
-
$('a.browse-images').hide()
|
23
|
-
|
24
|
-
initEditor: (options) =>
|
25
|
-
editor = new wysihtml5.Editor options.id, #textarea-id
|
26
|
-
toolbar: options.toolbarID # id of toolbar element
|
27
|
-
parserRules: wysihtml5ParserRules # defined in parser rules set
|
28
|
-
stylesheets: [ WYSIWYG_BASE_STYLES, WYSIWYG_CUSTOM_STYLES ] # defined in admin.html.erb
|
29
|
-
|
30
|
-
fetchImages: =>
|
31
|
-
@collection.fetch
|
32
|
-
success: (images) =>
|
33
|
-
@images = images.toJSON()
|
34
|
-
@renderImages()
|
35
|
-
$("#{@imagesContainer} img").click (e) =>
|
36
|
-
$('input.insert-image').val window.location.origin+$(e.target).data('src')
|
37
|
-
@closeModal()
|
38
|
-
|
39
|
-
renderImages: =>
|
40
|
-
$(@imagesContainer).html ""
|
41
|
-
if @images.length > 0
|
42
|
-
_.each @images, (image) =>
|
43
|
-
if image.filename
|
44
|
-
$(@imagesContainer).append @imageTemplate(image: image)
|
45
|
-
|
46
|
-
renderInsertImageModal: =>
|
47
|
-
$(window).resize(@positionInsertImageModal)
|
48
|
-
$("#{@modal} .modal a.close").click @closeModal
|
49
|
-
|
50
|
-
closeModal: =>
|
51
|
-
$(@modal).hide()
|
52
|
-
$(@el).css
|
53
|
-
overflow: 'auto'
|
54
|
-
height: 'auto'
|
55
|
-
|
56
|
-
initInsertImage: (e) =>
|
57
|
-
$(@el).css
|
58
|
-
overflow: 'hidden'
|
59
|
-
height: '100%'
|
60
|
-
@fetchImages()
|
61
|
-
@positionInsertImageModal()
|
62
|
-
$(@modal).show()
|
63
|
-
|
64
|
-
positionInsertImageModal: =>
|
65
|
-
ww = $(window).width()
|
66
|
-
wh = $(window).height()
|
67
|
-
left = ( ww / 2 ) - 331
|
68
|
-
top = ( wh / 2 ) - 200
|
69
|
-
$("#{@modal} .modal").css
|
70
|
-
top: "#{top}px"
|
71
|
-
left: "#{left}px"
|
72
|
-
|
73
|
-
initImageUpload: =>
|
74
|
-
$("#image_filename").attr "name", "image[filename]"
|
75
|
-
$("#new_image").fileupload
|
76
|
-
add: (e,data) ->
|
77
|
-
$(".images-container").prepend """
|
78
|
-
<div class="loading">Uploading #{data.files[0].name}...</div>
|
79
|
-
"""
|
80
|
-
data.submit()
|
81
|
-
complete: (e,data) =>
|
82
|
-
@fetchImages()
|
83
|
-
$(".images-container div.loading").first().remove()
|
84
|
-
# $(".images-container div.loading").insertBefore( $(".images-container img").first() )
|
85
|
-
$(".images-container img").click (e) =>
|
86
|
-
$('input.insert-image').val $(e.target).data('src')
|
87
|
-
@closeModal()
|