cambium 1.2.3 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (114) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +8 -3
  3. data/.ruby-version +1 -0
  4. data/README.md +301 -0
  5. data/Rakefile +20 -1
  6. data/app/assets/javascripts/cambium/admin/application.js.coffee +1 -0
  7. data/app/assets/javascripts/cambium/admin/routers/router.js.coffee +8 -17
  8. data/app/assets/javascripts/cambium/admin/templates/image_cropper.jst.ejs +20 -0
  9. data/app/assets/javascripts/cambium/admin/templates/modal.jst.ejs +3 -0
  10. data/app/assets/javascripts/cambium/admin/views/editor.js.coffee +14 -0
  11. data/app/assets/javascripts/cambium/admin/views/image_cropper.js.coffee +27 -0
  12. data/app/assets/javascripts/cambium/admin/views/keyboard_shortcuts.js.coffee +17 -0
  13. data/app/assets/javascripts/cambium/admin/views/media_picker.js.coffee +38 -0
  14. data/app/assets/stylesheets/cambium/admin/application.scss +4 -0
  15. data/app/assets/stylesheets/cambium/admin/partials/_globals.scss +14 -0
  16. data/app/assets/stylesheets/cambium/admin/partials/components.scss +5 -4
  17. data/app/assets/stylesheets/cambium/admin/partials/forms.scss +95 -2
  18. data/app/assets/stylesheets/cambium/admin/partials/modal.scss +40 -0
  19. data/app/assets/stylesheets/cambium/admin/partials/pagination.scss +28 -0
  20. data/app/assets/stylesheets/cambium/admin/partials/tables.scss +18 -27
  21. data/app/assets/stylesheets/cambium/admin/partials/tiles.scss +57 -0
  22. data/app/controllers/cambium/admin/documents_controller.rb +11 -0
  23. data/app/controllers/cambium/admin/pages_controller.rb +15 -0
  24. data/app/controllers/cambium/admin/settings_controller.rb +32 -0
  25. data/app/controllers/cambium/admin_controller.rb +21 -9
  26. data/app/controllers/cambium/pages_controller.rb +17 -0
  27. data/app/helpers/cambium/cambium_helper.rb +148 -116
  28. data/app/models/cambium/document.rb +59 -0
  29. data/app/models/cambium/page.rb +84 -0
  30. data/app/models/cambium/page_template.rb +85 -0
  31. data/app/models/cambium/setting.rb +40 -0
  32. data/app/models/concerns/publishable.rb +0 -21
  33. data/app/views/cambium/admin/documents/index.html.erb +21 -0
  34. data/app/views/cambium/admin/pages/edit.html.erb +16 -0
  35. data/app/views/cambium/admin/paper_trail/versions/_version.html.erb +1 -1
  36. data/app/views/cambium/admin/search/index.html.erb +2 -1
  37. data/app/views/cambium/admin/settings/index.html.erb +15 -0
  38. data/app/views/cambium/pages/home_missing.html.erb +2 -0
  39. data/app/views/layouts/admin.html.erb +1 -1
  40. data/app/views/pages/default.html.erb +13 -0
  41. data/bin/rails +12 -0
  42. data/cambium.gemspec +9 -3
  43. data/config/routes.rb +12 -0
  44. data/db/migrate/20160107161039_create_cambium_pages.rb +19 -0
  45. data/db/migrate/20160108160638_create_cambium_documents.rb +11 -0
  46. data/db/migrate/20160108185904_create_cambium_settings.rb +10 -0
  47. data/db/migrate/20160111154240_add_is_home_to_pages.rb +5 -0
  48. data/db/migrate/20160125174822_add_page_path_to_pages.rb +5 -0
  49. data/db/migrate/20160205190935_add_upload_gravity_to_documents.rb +5 -0
  50. data/lib/cambium.rb +3 -0
  51. data/lib/cambium/engine.rb +21 -0
  52. data/lib/cambium/version.rb +1 -1
  53. data/lib/generators/cambium/admin_generator.rb +1 -1
  54. data/lib/generators/templates/config/admin/documents.yml +23 -0
  55. data/lib/generators/templates/config/admin/pages.yml +56 -0
  56. data/lib/generators/templates/config/admin/settings.yml +19 -0
  57. data/lib/generators/templates/config/admin/sidebar.yml +15 -0
  58. data/lib/generators/templates/config/initializers/assets.rb +3 -1
  59. data/spec/controllers/cambium/admin/documents_controller_spec.rb +7 -0
  60. data/spec/controllers/cambium/admin/pages_controller_spec.rb +7 -0
  61. data/spec/controllers/cambium/admin/settings_controller_spec.rb +7 -0
  62. data/spec/controllers/cambium/pages_controller_spec.rb +7 -0
  63. data/spec/dummy/README.rdoc +28 -0
  64. data/spec/dummy/Rakefile +6 -0
  65. data/spec/dummy/app/assets/images/.keep +0 -0
  66. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  67. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  68. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  69. data/spec/dummy/app/controllers/concerns/.keep +0 -0
  70. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  71. data/spec/dummy/app/mailers/.keep +0 -0
  72. data/spec/dummy/app/models/.keep +0 -0
  73. data/spec/dummy/app/models/concerns/.keep +0 -0
  74. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  75. data/spec/dummy/bin/bundle +3 -0
  76. data/spec/dummy/bin/rails +4 -0
  77. data/spec/dummy/bin/rake +4 -0
  78. data/spec/dummy/bin/setup +29 -0
  79. data/spec/dummy/config.ru +4 -0
  80. data/spec/dummy/config/application.rb +32 -0
  81. data/spec/dummy/config/boot.rb +5 -0
  82. data/spec/dummy/config/database.yml +25 -0
  83. data/spec/dummy/config/environment.rb +5 -0
  84. data/spec/dummy/config/environments/development.rb +41 -0
  85. data/spec/dummy/config/environments/production.rb +79 -0
  86. data/spec/dummy/config/environments/test.rb +42 -0
  87. data/spec/dummy/config/initializers/assets.rb +11 -0
  88. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  89. data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
  90. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  91. data/spec/dummy/config/initializers/inflections.rb +16 -0
  92. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  93. data/spec/dummy/config/initializers/session_store.rb +3 -0
  94. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  95. data/spec/dummy/config/locales/en.yml +23 -0
  96. data/spec/dummy/config/routes.rb +4 -0
  97. data/spec/dummy/config/secrets.yml +22 -0
  98. data/spec/dummy/lib/assets/.keep +0 -0
  99. data/spec/dummy/log/.keep +0 -0
  100. data/spec/dummy/public/404.html +67 -0
  101. data/spec/dummy/public/422.html +67 -0
  102. data/spec/dummy/public/500.html +66 -0
  103. data/spec/dummy/public/favicon.ico +0 -0
  104. data/spec/factories/cambium_documents.rb +7 -0
  105. data/spec/factories/cambium_pages.rb +6 -0
  106. data/spec/factories/cambium_settings.rb +7 -0
  107. data/spec/models/cambium/document_spec.rb +7 -0
  108. data/spec/models/cambium/page_spec.rb +7 -0
  109. data/spec/models/cambium/setting_spec.rb +7 -0
  110. data/spec/spec_helper.rb +18 -0
  111. metadata +219 -11
  112. data/test/controllers/cambium/admin/dashboard_controller_test.rb +0 -9
  113. data/test/controllers/cambium/admin/users_controller_test.rb +0 -9
  114. data/test/controllers/cambium/admin_controller_test.rb +0 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6c8b304242f9dbd63f0dae18e86addc32e179e27
4
- data.tar.gz: f465d1014276a227f7f2926e4bf357db1e6e2d33
3
+ metadata.gz: 29da11f3322f226331391271921de5a185c1e038
4
+ data.tar.gz: bc1726947ccc6aac36768db892bb9916413f4d1c
5
5
  SHA512:
6
- metadata.gz: e1f60dae6425e18802ac29e4f2c84b052887a548d30bf1e6303d598b4625b43a1872059202536b50867b6fcf0a592e8c08a342556f79f48e7d471f014edb7f9c
7
- data.tar.gz: 79b4fea86dda7920dc4045666f1ac85f4fee4487d7fc85f55ffbc524ae42c54ef68c45cc43fece516dbb8ffed8feb079ba0af63a1dd6724930742ca32f5202e6
6
+ metadata.gz: ebca18b41a35ec1eb921edc0dd0c766417bde5fc0f60b7b63d2ed688c066ce6c20d1ec8137e47abdef88e61f78b1047485ab135da55fbc7a81a0d7f4177cf94b
7
+ data.tar.gz: 4868fff7264adcb70ab546c3f54f9499a372684a492eba871cd9077302a83a790478eee1d0981c5a50d90d329b9cf8d30c8dba71c1d560c370ccf937787e0d25
data/.gitignore CHANGED
@@ -11,9 +11,6 @@ doc/
11
11
  lib/bundler/man
12
12
  pkg
13
13
  rdoc
14
- spec/reports
15
- test/tmp
16
- test/version_tmp
17
14
  tmp
18
15
  *.bundle
19
16
  *.so
@@ -21,3 +18,11 @@ tmp
21
18
  *.a
22
19
  mkmf.log
23
20
  *.DS_Store
21
+
22
+ # Dummy App for Testing
23
+ spec/dummy/db/*.sqlite3
24
+ spec/dummy/db/*.sqlite3-journal
25
+ spec/dummy/log/*.log
26
+ spec/dummy/tmp/
27
+ spec/dummy/.sass-cache
28
+ spec/reports
@@ -0,0 +1 @@
1
+ 2.2.3
data/README.md CHANGED
@@ -112,6 +112,16 @@ At this point, you should be able to go to `localhost:3000/admin` and be
112
112
  redirected to the login page (if you are not signed in). Once you have an admin
113
113
  user and sign in successfully, you will be redirected to the admin dashboard.
114
114
 
115
+ ### Default Features
116
+
117
+ When you run the generators, you will get a handful of features by default.
118
+ Cambium now ships with users, pages, media, and settings. Of these four, users
119
+ is the only model that will be inserted directly in your app. Cambium handles
120
+ the others.
121
+
122
+ See below for configuration and for adding users, while the following sections
123
+ talk about how pages, media, and settings work.
124
+
115
125
  ### Adding Users
116
126
 
117
127
  We have a generator for creating a new user, which takes an `--admin` option if
@@ -214,6 +224,8 @@ table:
214
224
  columns:
215
225
  email:
216
226
  heading: Email
227
+ sortable: true
228
+ display_method: email_address
217
229
  buttons:
218
230
  new: New User
219
231
  export:
@@ -255,6 +267,13 @@ Every setting plays a role. Let's step through each one.
255
267
  * `table:columns:[column]`: Each column gets its own unique key, which
256
268
  distinguishes it from others
257
269
  * `table:columns:[column]:heading`: The label for the column in the data table.
270
+ * `table:columns:[column]:sortable`: Makes the column heading a link that will
271
+ sort the data based on that column. This means **the column must be a column
272
+ in the database**.
273
+ * `table:columns:[column]:display_method`: Provides ability to use an alias
274
+ method for displaying the content. For example, you may store a `state` as a
275
+ integer but want to return a `status` string for the table. You'd use `state`
276
+ as the column and `status` as the display method.
258
277
  * `table:buttons:new`: Label for the "New" button. If you don't want a
259
278
  new button, remove this setting.
260
279
  * `export`: This section handles an export option for your data table. Remove
@@ -279,6 +298,9 @@ Every setting plays a role. Let's step through each one.
279
298
  * `form:[new/edit]:fields:[field]:type`: The type of the HTML field to render,
280
299
  which uses [SimpleForm](https://github.com/plataformatec/simple_form). *You
281
300
  can use `heading` here to break up your fields.*
301
+ * `form:[new/edit]:fields:[field]:crop`: If set to `true`, it will display a
302
+ "Crop Image" option _after_ a file has been uploaded. This only applies to
303
+ `file` types.
282
304
  * `form:[new/edit]:fields:[field]:readonly`: If set to `true`, it will add the
283
305
  `readonly` attribute to the input field. *Not supported for markdown fields*.
284
306
 
@@ -287,6 +309,24 @@ Every setting plays a role. Let's step through each one.
287
309
  > editors. You can pass `markdown` as the `type` option and it will give you a
288
310
  > markdown editor.
289
311
 
312
+ #### A Note On Files
313
+
314
+ File fields use [Dragonfly](https://markevans.github.io/dragonfly/) for
315
+ uploading and processing. To add an upload field to the CMS, you need to have
316
+ three attributes: `_name`, `_uid`, `_gravity`.
317
+
318
+ So, for example, if you have a field called, `upload`, You'll add the following
319
+ to your database **as string fields**:
320
+
321
+ - `upload_name`
322
+ - `upload_uid`
323
+ - `upload_gravity`
324
+
325
+ In addition to the features Dragonfly offers, Cambium has a built-in image
326
+ cropper. The option for this will appear _after_ a file has been uploaded _if
327
+ you specify the crop option for that field_. If those conditions are present,
328
+ you'll see a "Crop Image" below the image.
329
+
290
330
  ### Overriding the Base Controller
291
331
 
292
332
  I've rearranged Cambium's CMS controllers so there is a blank `BaseController`
@@ -312,6 +352,267 @@ end
312
352
  You can change `ApplicationController` to any other controller in your
313
353
  application.
314
354
 
355
+ Pages
356
+ ----------
357
+
358
+ Cambium now ships with a flexible pages feature.
359
+
360
+ ### How Pages Work
361
+
362
+ Cambium keeps the base functionality of the pages within the gem in the
363
+ `Cambium::Page` model. It provides a templating engine that enables you to add
364
+ custom templates and apply them to individual pages.
365
+
366
+ The way it works is that you apply a template to an individual page. When that
367
+ page is rendered, it will render the associated template file (minus the
368
+ frontmatter, explained below) **inside your application layout**.
369
+
370
+ ### Working With Templates
371
+
372
+ To add a new template, just add a file to `app/views/pages`. The name of the
373
+ file is what will drive the name of the template in the CMS.
374
+
375
+ To make everything work properly, it is recommended you **keep the default form
376
+ fields in your `pages.yml` config for the CMS.**
377
+
378
+ Templates can have a set of custom fields that enable you to capture custom
379
+ data on a page. You can't query that data directly, but you can get to it once
380
+ you have a page. The configuration for each template uses YAML frontmatter,
381
+ similar to [how Middleman works](https://middlemanapp.com/basics/frontmatter/).
382
+
383
+ Let's use an example to demonstrate. Let's say I have a `Post` model in my app
384
+ and I want a listing of posts to be displayed on a News template. I would begin
385
+ by creating a file for the news template: `app/views/pages/news.html.erb`.
386
+
387
+ Then let's say we want to capture a `tagline` attribute on the page. You would
388
+ place the frontmatter at the top of your file, and it will look something like
389
+ this:
390
+
391
+ ```text
392
+ ---
393
+ title: News
394
+ fields:
395
+ tagline:
396
+ type: string
397
+ label: Tagline
398
+ ---
399
+ ```
400
+
401
+ It's important in this case that you **don't put the frontmatter in a ruby
402
+ block** (`<% %>`). It needs to be in plain text on the page.
403
+
404
+ Once this information is there, you are able to add a page with the News
405
+ template in the CMS. Once you select the News template and save the page, the
406
+ form will show the custom `tagline` field as an option. Go ahead and populate
407
+ that field.
408
+
409
+ When you are creating the body of the template, it will all be based around the
410
+ `@page` object. Meanwhile, the values of your fields are available as attribute
411
+ on the `@page` object. So, if you wanted to display a listing of all the posts
412
+ on this template, your file might look something like this:
413
+
414
+ ```html
415
+ ---
416
+ title: News
417
+ fields:
418
+ tagline:
419
+ type: string
420
+ label: Tagline
421
+ ---
422
+
423
+ <h1><%= @page.title %></h1>
424
+ <h2><%= @page.tagline %></h2>
425
+
426
+ <ul>
427
+ <% Post.all.each do |post| %>
428
+ <li><%= link_to post.title, post %></li>
429
+ <% end %>
430
+ </ul>
431
+ ```
432
+
433
+ ### Setting Your Home Page
434
+
435
+ The page form has a _Set as home page_ option on it. If you check this, that
436
+ page will be designated as the home page of your application. To make it work,
437
+ you'll have to amend your `root` call in `config/routes.rb` to load Cambium's
438
+ home page.
439
+
440
+ ```ruby
441
+ root :to => 'cambium/pages#home'
442
+ ```
443
+
444
+ If you don't have a page set as the home page, this will fail gracefully. If
445
+ you have two pages set as the home page, it's going to pick the first match. In
446
+ other words, setting a page as the home page doesn't unset all the other home
447
+ pages.
448
+
449
+ ### Options
450
+
451
+ There are a few methods on the `Cambium::Page` class:
452
+
453
+ - `home`: The home page.
454
+ - `published`: Published pages.
455
+ - `unpublished`: Unpublished pages.
456
+
457
+ On an instance of a `Cambium::Page`, you can call the following methods:
458
+
459
+ - `template`: A `PageTemplate` instance (see below for those options).
460
+ - `body`: The body of the page (it's main block of content).
461
+ - `published?`: Is the page published?
462
+ - `publish!`: Publish the page.
463
+
464
+ There are also a few attributes on an instance of a `Cambium::Page`:
465
+
466
+ - `title`
467
+ - `slug`: Automatically generated from the title.
468
+ - `description`
469
+ - `position`
470
+ - `page_path`: The full path to the page, including ancestors.
471
+ - `title_path`: Combines all the titles of the ancestors, split by `:`.
472
+
473
+ The `Cambium::PageTemplate` class mainly focuses on the field values for a
474
+ particular page, which it makes available as dynamic methods. But on the class
475
+ itself, you have a few methods:
476
+
477
+ - `all`: The templates in your app.
478
+ - `names`: The names of all the templates in your app.
479
+ - `find`: Takes a `name` argument and will return that template if it exists.
480
+
481
+ ### Adding Media
482
+
483
+ Cambium also ships with a media library by default. You can apply files from
484
+ the library to an individual page. But, unlike other Cambium admin controllers,
485
+ you won't use `file` as the field type. Instead it is a `media` field type
486
+ which is specifically designed to pull files from the media library.
487
+
488
+ So, let's say you wanted to add a `featured_image` field to your News template. Your frontmatter may then look something like this:
489
+
490
+ ```text
491
+ ---
492
+ title: News
493
+ fields:
494
+ tagline:
495
+ type: string
496
+ label: Tagline
497
+ featured_image:
498
+ type: media
499
+ label: Featured Image
500
+ ---
501
+ ```
502
+
503
+ Accessing the actual file will work a little differently, though. We are using
504
+ Dragonfly for handling uploads and processing, so you don't get the URL
505
+ directly. Instead you get the `Document` object, which provides some
506
+ flexibility on what you can do with it.
507
+
508
+ For example, if you just wanted the URL to the file itself, then you might add
509
+ this to your template:
510
+
511
+ ```html
512
+ <%= @page.featured_image.upload.url %>
513
+ ```
514
+
515
+ But what if you wanted it cropped on the fly? You could do something like this:
516
+
517
+ ```html
518
+ <%= @page.featured_image.upload.thumb('300x300#').url %>
519
+ ```
520
+
521
+ ### Adding/Overriding Functionality
522
+
523
+ Cambium pages use the `Cambium::Page` model. If you want to add some additional
524
+ functionality or change some inherent functionality, you could create a page
525
+ model (`app/models/page.rb`) that inherits from `Cambium::Page`.
526
+
527
+ ```ruby
528
+ class Page < Cambium::Page
529
+ # your custom configuration
530
+ end
531
+ ```
532
+
533
+ You'll then need to override the controller and access the `Page` model instead
534
+ of the `Cambium::Page` model. Place the following code in
535
+ `app/controllers/cambium/pages_controller.rb`.
536
+
537
+ ```ruby
538
+ class Cambium::PagesController < ApplicationController
539
+ def show
540
+ slug = request.path.split('/').last
541
+ @page = ::Page.find_by_slug(slug)
542
+ render :inline => @page.template.content, :layout => 'application'
543
+ end
544
+
545
+ def home
546
+ @page = ::Page.home
547
+ if @page.nil?
548
+ render 'home_missing'
549
+ else
550
+ render :inline => @page.template.content, :layout => 'application'
551
+ end
552
+ end
553
+ end
554
+ ```
555
+
556
+ ### Disabling Pages
557
+
558
+ You can't technically disable pages, but you can _hide_ its functionality. The
559
+ best thing to do is to remove its configuration file (`config/admin/pages.yml`)
560
+ and remove it from the sidebar config (`config/admin/sidebar.yml`).
561
+
562
+ Media Library
563
+ ----------
564
+
565
+ Cambium now ships with a media library. This lets you upload all your files to
566
+ one main library. This feature especially will receive much more attention over
567
+ time. Currently, they are built to be easily connected to pages.
568
+
569
+ To work with pages, see the previous section.
570
+
571
+ Cambium uses Dragonfly for uploading and image processing. To access a document
572
+ directly, you will use the `Cambium::Document` model. Once you have a
573
+ individual object, you can get to the Dragonfly methods through the `upload`
574
+ attribute.
575
+
576
+ So, for example, you can get to the page of the file with
577
+ `document.upload.url`, where `document` is a `Cambium::Document` object.
578
+
579
+ ### Options
580
+
581
+ Here are the other methods on a document instance:
582
+
583
+ - `image?`: Is the file an image?
584
+ - `pdf?`: Is the file a PDF?
585
+ - `has_thumb?`: Can we generate an image thumbnail for the file?
586
+ - `thumb_url`: The URL to the thumbnail image (if it can be created).
587
+ - `ext`: The file extension
588
+
589
+ Site Settings
590
+ ----------
591
+
592
+ Cambium also ships with site settings, which focuses on enabling your users to
593
+ change setting through the UI.
594
+
595
+ You work with this like you would any other model, except it's more about
596
+ finding individual records instead of creating custom fields for an object.
597
+
598
+ In other words, all the configuration happens in your `config/admin/settings.yml` file. You can see there are some default ones:
599
+
600
+ ```yaml
601
+ site_title:
602
+ type: string
603
+ label: Site Title
604
+ site_description:
605
+ type: text
606
+ label: Site Description
607
+ ```
608
+
609
+ Any setting field you create you can access from the `Cambium::Setting` model.
610
+ So, for example, if you want the value of `site_title` from the above config,
611
+ you just query: `Cambium::Setting.site_title`.
612
+
613
+ Be warned, though, that if you need several settings on one page, you're better
614
+ off grabbing a collection of the settings and then grabbing from your results
615
+ as you need them. I'll leave that up to you!
315
616
 
316
617
  Model Options
317
618
  ----------
data/Rakefile CHANGED
@@ -1 +1,20 @@
1
- require "bundler/gem_tasks"
1
+ #!/usr/bin/env rake
2
+ begin
3
+ require 'bundler/setup'
4
+ rescue LoadError
5
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
+ end
7
+
8
+ APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
9
+ load 'rails/tasks/engine.rake'
10
+
11
+ Bundler::GemHelper.install_tasks
12
+
13
+ Dir[File.join(File.dirname(__FILE__), 'tasks/**/*.rake')].each {|f| load f }
14
+
15
+ require 'rspec/core'
16
+ require 'rspec/core/rake_task'
17
+
18
+ desc "Run all specs in spec directory (excluding plugin specs)"
19
+ RSpec::Core::RakeTask.new(:spec => 'app:db:test:prepare')
20
+ task :default => :spec
@@ -1,5 +1,6 @@
1
1
  #= require jquery
2
2
  #= require jquery_ujs
3
+ #= require trumbowyg/trumbowyg
3
4
  #= require mark_it_zero
4
5
  #= require pickadate/picker
5
6
  #= require pickadate/picker.date
@@ -1,25 +1,16 @@
1
1
  class App.Routers.Router extends Backbone.Router
2
2
 
3
- initialize: =>
4
- @autoLoadClass()
5
-
6
- autoLoadClass: =>
7
- # This is a good place to automatically load classes that may be dependent
8
- # on a page element, and not necessarily the route.
9
- #
10
- # For example:
11
- #
12
- # new App.Views.Nav if $('.main-nav').length > 0
13
- #
14
- # Or, perhaps you need to load a class on every page. Do that, here, too,
15
- # like this:
16
- #
3
+ initialize: ->
17
4
  new App.Views.DefaultHelpers
18
5
  new App.Views.DropdownMenu if $('.dropdown-menu').length > 0
19
6
  new App.Views.Pickadate
7
+ new App.Views.Editor
8
+ new App.Views.MediaPicker
9
+ new App.Views.ImageCropper
10
+ new App.Views.KeyboardShortcuts
20
11
 
21
12
  routes:
22
- '': 'initHomePage'
13
+ 'admin': 'admin'
23
14
 
24
- initHomePage: ->
25
- console.log "Welcome to this awesome site, built using Cambium!"
15
+ admin: ->
16
+ true
@@ -0,0 +1,20 @@
1
+ <div id="modal-container">
2
+ <div id="title-bar">
3
+ <h2 class="page-title">Crop Image</h2>
4
+ <p>Click the focus of the image.</p>
5
+ </div>
6
+ <div class="image-container">
7
+ <div class="gravity">
8
+ <div data-gravity="nw"></div>
9
+ <div data-gravity="n"></div>
10
+ <div data-gravity="ne"></div>
11
+ <div data-gravity="w"></div>
12
+ <div data-gravity=""></div>
13
+ <div data-gravity="e"></div>
14
+ <div data-gravity="sw"></div>
15
+ <div data-gravity="s"></div>
16
+ <div data-gravity="se"></div>
17
+ </div>
18
+ <img src="<%= image.url %>">
19
+ </div>
20
+ </div>