activeadmin-generator 0.0.12 → 0.0.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (28) hide show
  1. data/.gitignore +2 -0
  2. data/README.md +1 -1
  3. data/lib/active_admin/generator/templates/app/assets/images/s/credits.png +0 -0
  4. data/lib/active_admin/generator/templates/app/assets/stylesheets/_layout.css.sass +1 -0
  5. data/lib/active_admin/generator/templates/app/assets/stylesheets/_site_colors.css.sass +15 -0
  6. data/lib/active_admin/generator/templates/app/assets/stylesheets/_site_mixins.css.sass +4 -0
  7. data/lib/active_admin/generator/templates/app/assets/stylesheets/application.css.sass +32 -12
  8. data/lib/active_admin/generator/templates/app/assets/stylesheets/basic/_cms.css.sass +53 -0
  9. data/lib/active_admin/generator/templates/app/assets/stylesheets/basic/_config.css.sass +54 -0
  10. data/lib/active_admin/generator/templates/app/assets/stylesheets/basic/_fonts.css.sass +30 -1
  11. data/lib/active_admin/generator/templates/app/assets/stylesheets/basic/_forms.css.sass +36 -0
  12. data/lib/active_admin/generator/templates/app/assets/stylesheets/basic/_media-queries.css.sass +157 -0
  13. data/lib/active_admin/generator/templates/app/assets/stylesheets/basic/_mixins.css.sass +69 -0
  14. data/lib/active_admin/generator/templates/app/assets/stylesheets/basic/_tables.css.sass +22 -0
  15. data/lib/active_admin/generator/templates/app/assets/stylesheets/modules/_module_example.css.sass +4 -0
  16. data/lib/active_admin/generator/templates/app/assets/stylesheets/sections/_home.css.sass +2 -0
  17. data/lib/active_admin/generator/templates/config/initializers/dragonfly.rb +39 -13
  18. data/lib/active_admin/generator/version.rb +1 -1
  19. metadata +15 -11
  20. data/lib/active_admin/generator/templates/app/assets/stylesheets/basic/_layout.css.sass +0 -7
  21. data/lib/active_admin/generator/templates/app/assets/stylesheets/basic/_sprites.css.sass +0 -6
  22. data/lib/active_admin/generator/templates/app/assets/stylesheets/lib/_colors.css.sass +0 -0
  23. data/lib/active_admin/generator/templates/app/assets/stylesheets/lib/_mixins.css.sass +0 -0
  24. data/lib/active_admin/generator/templates/app/assets/stylesheets/lib/_variables.css.sass +0 -0
  25. data/lib/active_admin/generator/templates/app/assets/stylesheets/modules/.empty_directory +0 -0
  26. data/lib/active_admin/generator/templates/app/assets/stylesheets/sections/.empty_directory +0 -0
  27. data/lib/active_admin/generator/templates/app/assets/stylesheets/themes/.empty_directory +0 -0
  28. data/lib/active_admin/generator/templates/app/models/asset_thumb.rb +0 -4
data/.gitignore CHANGED
@@ -1 +1,3 @@
1
1
  pkg
2
+ .DS_Store
3
+
data/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  ```
6
6
  gem install activeadmin-generator
7
- activeadmin-generator new my_app
7
+ activeadmin-generate new my_app
8
8
  ```
9
9
 
10
10
  ## Default configurations
@@ -0,0 +1 @@
1
+ // DEFINE YOUR GENERIC BASE STYLE FOR TAGS AND CLASSES
@@ -0,0 +1,15 @@
1
+ // Define the colors for your specific website
2
+ // You can overwrite colors defined in in libs/config
3
+ // every colors is named as $c-color-name
4
+ // example
5
+
6
+ // $c-black: #ddd;
7
+ // $c-black-light: lighten($c-black, 10%);
8
+ // $c-pink-dark: darken($c-pink, 30%);
9
+
10
+ // SECTIONS: uncomment and build your favourites
11
+ // here some example
12
+ $c-main: $c-cyan
13
+ $c-text: $c-black
14
+ $c-link: $c-green
15
+ $c-button: $c-main
@@ -0,0 +1,4 @@
1
+ @import site_colors
2
+ @import basic/mixins
3
+
4
+ // Create your specific mixin hereunder
@@ -1,21 +1,41 @@
1
- /* Third party libraries
2
- @import compass
1
+ // What is applications SCSS?
2
+ // Here you con import all css files you need for your website
3
+ // and link just this single file into your html head section
4
+ // you'll cache one single file, faster and easier to be mantained
3
5
 
4
- // Internal variables and mixins
5
- @import lib/variables
6
- @import lib/colors
7
- @import lib/mixins
6
+ // MIND THE ORDER!
8
7
 
8
+ // 1 - IMPORT LIBRARIES AND THIRD PARTIES CSS
9
+ /* Libraries and resets */
10
+ @import basic/config
11
+
12
+ // general configuration for colors, hive etc.
9
13
  +global-reset
10
14
 
11
- /* Basic styles
15
+ // html / css compass reset
16
+ @import basic/hive
17
+
18
+ // the responsive grid
12
19
  @import basic/fonts
13
- @import basic/sprites
14
- @import basic/layout
20
+ @import basic/tables
21
+ @import basic/forms
22
+ @import basic/cms
23
+ @import basic/media-queries
15
24
 
16
- /* Modules
25
+ // 2 - IMPORT THE MAIN CSS FILE OF YOUR SITE
26
+ /* BASIC STYLES */
27
+ @import layout
17
28
 
18
- /* Sections
29
+ // 3 - IMPORT OBJECT MODULES
30
+ // import order is important, deepest mdules first or build a folders structure for each module
31
+ /* SITE MODULES */
32
+ @import modules/module_example
19
33
 
20
- /* Themes
34
+ // 4 - IMPORT SECTIONS
35
+ // sections are usually templates and specific layouts of your site
36
+ /* SITE SECTIONS */
37
+ @import sections/home
21
38
 
39
+ // 5 - IMPORT THEMES
40
+ /* SITE THEMES */
41
+ // @import "themes/blue";
@@ -0,0 +1,53 @@
1
+ /* STYLES FOR ARTICLES AND TYPO SECTIONS */
2
+ .cms
3
+ $cms-header-max: 1.5em !default
4
+ $cms-margin: 5px !default
5
+ h1, h2, h3, h4, h5
6
+ +special-font($cms-margin)
7
+ h1
8
+ font-size: 100%
9
+ h2
10
+ font-size: 85%
11
+ h3
12
+ font-size: 75%
13
+ img
14
+ margin: $cms-margin 0
15
+ vertical-align: middle
16
+ &.right
17
+ float: right
18
+ margin: $cms-margin 0 $cms-margin $cms-margin
19
+ &.left
20
+ float: left
21
+ margin: $cms-margin $cms-margin $cms-margin 0
22
+ &.center
23
+ display: block
24
+ margin: $cms-margin auto
25
+ p
26
+ dl
27
+ dt
28
+ dd
29
+ ul, ol
30
+ margin: $cms-margin * 2 $cms-margin * 4
31
+ li
32
+ a
33
+ &:hover
34
+ ul
35
+ list-style: disc
36
+ li
37
+ line-height: 1.5em
38
+ &:before
39
+ a
40
+ &:hover
41
+ em
42
+ strong
43
+ img
44
+ blockquote
45
+ font-style: italic
46
+ padding: $cms-margin $cms-margin * 4
47
+ pre
48
+ line-height: 1.2em
49
+ font-size: 1.1em
50
+ font-family: "Courier New", Courier, monospace
51
+ margin: 0.5 0
52
+ padding-left: 2em
53
+ code
@@ -0,0 +1,54 @@
1
+ // PUBLIC VARIABLES FOR YOUR SITE
2
+ // ******************************
3
+
4
+ // exmples
5
+ // $hive-responsive: true;
6
+ // $site-footer-height: 250px;
7
+ // $site-debug: 0;
8
+ // $hive-vertical-unit-box-height: 300px;
9
+
10
+ // CMS, TABLES AND FORMS SETTINGS
11
+ // $cms-margin: 5px;
12
+
13
+ // **********************************************************
14
+ // PRIVATE VARIABLES
15
+ // **********************************************************
16
+ // **********************************************************
17
+ // **********************************************************
18
+ // **********************************************************
19
+ // **********************************************************
20
+ // PLS DON'T CHANGE HEREUNDER TILL YOU KNOW WHAT YOUR DOING!
21
+ // **********************************************************
22
+
23
+ // BASIC COLORS LIBRARY
24
+ $c-black: black
25
+ $c-blue: #12579c
26
+ $c-brown: #6e3201
27
+ $c-beige: #f1f1f3
28
+ $c-cyan: #00aeef
29
+ $c-gray: #939597
30
+ $c-green: #41ac00
31
+ $c-gold: #e5ba05
32
+ $c-magenta: #ec008c
33
+ $c-orange: #ff7200
34
+ $c-petrol: #0e4861
35
+ $c-pink: #ff8ba6
36
+ $c-red: #e10000
37
+ $c-violet: #8602d1
38
+ $c-yellow: #ffcf06
39
+ $c-white: white
40
+
41
+ $site-debug: false
42
+
43
+ // COMPASS CONFIG
44
+ $experimental-support-for-svg: true
45
+ $s-layout: smart
46
+
47
+ @import s/*.png
48
+
49
+ // 3rd parties libs
50
+ @import compass
51
+ @import site_colors
52
+ @import site_mixins
53
+
54
+ +debug($site-debug)
@@ -1,4 +1,33 @@
1
1
  /* Fonts */
2
+ // set the refers name of the special font you wish to use
3
+ // put your font into /css/fonts/ directory
2
4
 
3
- // +font-face("Font Name", font-files("font.ttf", "font.woff"), "font.eot", normal, normal)
5
+ @font-face
6
+ font-family: "BebasNeueRegular"
7
+ src: url("fonts/BebasNeue-webfont.eot")
8
+ src: url("fonts/BebasNeue-webfont.eot?#iefix") format("embedded-opentype"), url("fonts/BebasNeue-webfont.woff") format("woff"), url("fonts/BebasNeue-webfont.ttf") format("truetype"), url("fonts/BebasNeue-webfont.svg#BebasNeueRegular") format("svg")
9
+ font-weight: normal
10
+ font-style: normal
4
11
 
12
+ =font-base
13
+ line-height: 1.2em
14
+ font-smooth: always
15
+ zoom: 1
16
+ -webkit-font-smoothing: antialiased
17
+ -webkit-text-size-adjust: 100%
18
+ -ms-text-size-adjust: 100%
19
+
20
+ =special-font($size: 1em)
21
+ +font-base
22
+ font-family: "BebasNeueRegular"
23
+ font-size: $size
24
+
25
+ =serif-font($size: 1em)
26
+ +font-base
27
+ font-family: "Georgia", "Times New Roman", Times, serif
28
+ font-size: $size
29
+
30
+ =sans-font($size: 1em)
31
+ +font-base
32
+ font-family: "Helvetica Neue Regular", "Helvetica Neue", Helvetica, Arial, sans-serif
33
+ font-size: $size
@@ -0,0 +1,36 @@
1
+ /* BASIC FORMS STYLE */
2
+ form.standard-form
3
+ fieldset
4
+ legend
5
+ label
6
+ span
7
+ input
8
+ input, textarea, select
9
+ input[type="text"], input[type="password"], textarea
10
+ input[type="radio"], input[type="checkbox"]
11
+ textarea
12
+ select
13
+ div
14
+ &.field
15
+ .help-text
16
+ &.required
17
+ label
18
+ &:before
19
+ content: "* "
20
+ &.error
21
+ label
22
+ color: $c-red
23
+ input[type="text"],input[type="password"]
24
+ .errorlist
25
+ li
26
+ font-style: italic
27
+ padding-left: 15px
28
+ font-size: 90%
29
+ &:before
30
+ display: inline
31
+ &.inline
32
+ display: inline
33
+ &.short
34
+ width: 30%
35
+ &.medium
36
+ width: 45%
@@ -0,0 +1,157 @@
1
+ // ---------------------------------------------------------------------------------------------------------------------
2
+ //
3
+ // Author: Rafal Bromirski
4
+ // www: http://paranoida.com/
5
+ // twitter: http://twitter.com/paranoida
6
+ // dribbble: http://dribbble.com/paranoida
7
+ //
8
+ // Licensed under a MIT License
9
+ //
10
+ // ---------------------------------------------------------------------------------------------------------------------
11
+ //
12
+ // Requirements:
13
+ // Sass 3.2.0+
14
+ //
15
+ // Version:
16
+ // 2.2 // developed on 25/02/2013
17
+ //
18
+ // Variables:
19
+ // $units: 1px; // default units for 'screen' mixins - it must include a digit!
20
+ //
21
+ // Mixins:
22
+ // @ min-screen(width) // shortcut for @media screen and (min-width ...)
23
+ // @ max-screen(width) // shortcut for @media screen and (max-width ...)
24
+ // @ screen(min-width, max-width) // shortcut for @media screen and (min-width ...) and (max-width ...)
25
+ // ---
26
+ // @ iphone3 // only iPhone (2, 3G, 3GS) landscape & portrait
27
+ // @ iphone3-landscape // only iPhone (2, 3G, 3GS) only landscape
28
+ // @ iphone3-portrait // only iPhone (2, 3G, 3GS) only portrait
29
+ // ---
30
+ // @ iphone4 // only iPhone (4, 4S) landscape & portrait
31
+ // @ iphone4-landscape // only iPhone (4, 4S) only landscape
32
+ // @ iphone4-portrait // only iPhone (4, 4S) only portrait
33
+ // ---
34
+ // @ iphone5 // only iPhone (5) landscape & portrait
35
+ // @ iphone5-landscape // only iPhone (5) only landscape
36
+ // @ iphone5-portrait // only iPhone (5) only portrait
37
+ // ---
38
+ // @ ipad // only iPad (1, 2, Mini) landscape & portrait
39
+ // @ ipad-landscape // only iPad (1, 2, Mini) only landscape
40
+ // @ ipad-portrait // only iPad (1, 2, Mini) only portrait
41
+ // ---
42
+ // @ ipad-retina // only iPad (3, 4) landscape & portrait
43
+ // @ ipad-retina-landscape // only iPad (3, 4) only landscape
44
+ // @ ipad-retina-portrait // only iPad (3, 4) only portrait
45
+ // ---
46
+ // @ hdpi(ratio) // devices with hidpi displays (default ratio: 1.3)
47
+ //
48
+ // ---------------------------------------------------------------------------------------------------------------------
49
+
50
+ // ---------------------------------------------------------------------------------------------------------------------
51
+ // --- screen ----------------------------------------------------------------------------------------------------------
52
+ // ---------------------------------------------------------------------------------------------------------------------
53
+
54
+ $units: 1px !default
55
+
56
+ =screen($res-min, $res-max)
57
+ @media screen and (min-width: if(unitless($res-min), $res-min * $units, $res-min)) and (max-width: if(unitless($res-max), $res-max * $units, $res-max))
58
+ @content
59
+
60
+ =max-screen($res)
61
+ @media screen and (max-width: if(unitless($res), $res * $units, $res))
62
+ @content
63
+
64
+ =min-screen($res)
65
+ @media screen and (min-width: if(unitless($res), $res * $units, $res))
66
+ @content
67
+
68
+ // ---------------------------------------------------------------------------------------------------------------------
69
+ // --- hdpi ------------------------------------------------------------------------------------------------------------
70
+ // ---------------------------------------------------------------------------------------------------------------------
71
+
72
+ // Based on bourbon hidpi-media-queries file (https://github.com/thoughtbot/bourbon/blob/master/app/assets/stylesheets/css3/_hidpi-media-query.scss)
73
+ // HiDPI mixin. Default value set to 1.3 to target Google Nexus 7 (http://bjango.com/articles/min-device-pixel-ratio/)
74
+
75
+ =hdpi($ratio: 1.3)
76
+ @media only screen and (-webkit-min-device-pixel-ratio: $ratio), only screen and (min--moz-device-pixel-ratio: $ratio), only screen and (-o-min-device-pixel-ratio: #{$ratio}/1), only screen and (min-resolution: #{round($ratio * 96)}dpi), only screen and (min-resolution: #{$ratio}dppx)
77
+ @content
78
+
79
+ // ---------------------------------------------------------------------------------------------------------------------
80
+ // --- iphone ----------------------------------------------------------------------------------------------------------
81
+ // ---------------------------------------------------------------------------------------------------------------------
82
+
83
+ =iphone3
84
+ @media only screen and (min-device-width: 320px) and (max-device-width: 480px) and (-webkit-device-pixel-ratio: 1)
85
+ @content
86
+
87
+ =iphone3-portrait
88
+ @media only screen and (min-device-width: 320px) and (max-device-width: 480px) and (-webkit-device-pixel-ratio: 1) and (orientation: portrait)
89
+ @content
90
+
91
+ =iphone3-landscape
92
+ @media only screen and (min-device-width: 320px) and (max-device-width: 480px) and (-webkit-device-pixel-ratio: 1) and (orientation: landscape)
93
+ @content
94
+
95
+ // ---------------------------------------------------------------------------------------------------------------------
96
+ // --- iphone-retina ---------------------------------------------------------------------------------------------------
97
+ // ---------------------------------------------------------------------------------------------------------------------
98
+
99
+ =iphone4
100
+ @media only screen and (min-device-width: 320px) and (max-device-width: 480px) and (-webkit-device-pixel-ratio: 2) and (device-aspect-ratio: 2 / 3)
101
+ @content
102
+
103
+ =iphone4-portrait
104
+ @media only screen and (min-device-width: 320px) and (max-device-width: 480px) and (-webkit-device-pixel-ratio: 2) and (device-aspect-ratio: 2 / 3) and (orientation: portrait)
105
+ @content
106
+
107
+ =iphone4-landscape
108
+ @media only screen and (min-device-width: 320px) and (max-device-width: 480px) and (-webkit-device-pixel-ratio: 2) and (device-aspect-ratio: 2 / 3) and (orientation: landscape)
109
+ @content
110
+
111
+ // ---------------------------------------------------------------------------------------------------------------------
112
+ // --- iphone-5 --------------------------------------------------------------------------------------------------------
113
+ // ---------------------------------------------------------------------------------------------------------------------
114
+
115
+ =iphone5
116
+ @media only screen and (min-device-width: 320px) and (max-device-width: 568px) and (-webkit-device-pixel-ratio: 2) and (device-aspect-ratio: 40 / 71)
117
+ @content
118
+
119
+ =iphone5-portrait
120
+ @media only screen and (min-device-width: 320px) and (max-device-width: 568px) and (-webkit-device-pixel-ratio: 2) and (device-aspect-ratio: 40 / 71) and (orientation: portrait)
121
+ @content
122
+
123
+ =iphone5-landscape
124
+ @media only screen and (min-device-width: 320px) and (max-device-width: 568px) and (-webkit-device-pixel-ratio: 2) and (device-aspect-ratio: 40 / 71) and (orientation: landscape)
125
+ @content
126
+
127
+ // ---------------------------------------------------------------------------------------------------------------------
128
+ // --- ipad + ipad mini ------------------------------------------------------------------------------------------------
129
+ // ---------------------------------------------------------------------------------------------------------------------
130
+
131
+ =ipad
132
+ @media only screen and (min-device-width: 768px) and (max-device-width: 1024px) and (-webkit-device-pixel-ratio: 1)
133
+ @content
134
+
135
+ =ipad-portrait
136
+ @media only screen and (min-device-width: 768px) and (max-device-width: 1024px) and (-webkit-device-pixel-ratio: 1) and (orientation: portrait)
137
+ @content
138
+
139
+ =ipad-landscape
140
+ @media only screen and (min-device-width: 768px) and (max-device-width: 1024px) and (-webkit-device-pixel-ratio: 1) and (orientation: landscape)
141
+ @content
142
+
143
+ // ---------------------------------------------------------------------------------------------------------------------
144
+ // --- ipad-retina -----------------------------------------------------------------------------------------------------
145
+ // ---------------------------------------------------------------------------------------------------------------------
146
+
147
+ =ipad-retina
148
+ @media screen and (min-device-width: 768px) and (max-device-width: 1024px) and (-webkit-device-pixel-ratio: 2)
149
+ @content
150
+
151
+ =ipad-retina-portrait
152
+ @media screen and (min-device-width: 768px) and (max-device-width: 1024px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait)
153
+ @content
154
+
155
+ =ipad-retina-landscape
156
+ @media screen and (min-device-width: 768px) and (max-device-width: 1024px) and (-webkit-device-pixel-ratio: 2) and (orientation: landscape)
157
+ @content
@@ -0,0 +1,69 @@
1
+ // usefull mixins to extend compass
2
+
3
+ =debug($status, $color: red)
4
+ @if $status == 1
5
+ body
6
+ &:after
7
+ content: "WARNING! SASS DEBUG: ON - change $debug value in _config.scss"
8
+ position: fixed
9
+ width: 100%
10
+ height: 10px
11
+ bottom: 0
12
+ left: 0
13
+ z-index: 999
14
+ background-color: $color
15
+ color: white
16
+ padding: 7px
17
+ +sans-font(9px)
18
+
19
+ =animate($t: 1s)
20
+ -webkit-transition: all $t ease-in-out
21
+ -moz-transition: all $t ease-in-out
22
+ -o-transition: all $t ease-in-out
23
+ -ms-transition: all $t ease-in-out
24
+
25
+ =animation-config($duration: 1s, $delay: 1s, $loop: infinite)
26
+ -moz-animation-duration: $duration
27
+ -moz-animation-delay: $delay
28
+ -moz-animation-iteration-count: $loop
29
+ -webkit-animation-duration: $duration
30
+ -webkit-animation-delay: $delay
31
+ -webkit-animation-iteration-count: $loop
32
+
33
+ =bg-reset($color: transparent, $position: top left)
34
+ background-repeat: no-repeat
35
+ background-color: $color
36
+ background-position: $position
37
+
38
+ // TYPOGRAPHY
39
+ =ellipsis
40
+ white-space: nowrap
41
+ overflow: hidden
42
+ text-overflow: ellipsis
43
+
44
+ =delimited-list($separator: ", ")
45
+ li
46
+ display: inline
47
+ list-style-type: none
48
+ margin: 0px
49
+ padding: 0px
50
+ &:after
51
+ content: $separator
52
+ &:last-child
53
+ &:after
54
+ content: ""
55
+ &.last
56
+ &:after
57
+ content: ""
58
+
59
+ =bg-sprite($name, $display: block, $repeat: no-repeat, $offset-x: 0, $offset-y: 0)
60
+ // to use this sprite you need
61
+ // the $s variable setted by default in the config file
62
+ // and a /img/s directory with at least 1 png file inside
63
+ background-image: $s-sprites
64
+ background-repeat: $repeat
65
+ +sprite-background-position($s-sprites, $name, $offset-x, $offset-y)
66
+ display: $display
67
+ // if no offsets given, set the dimensions of the element to match the image
68
+ @if $offset-x == 0 and $offset-y == 0
69
+ +sprite-dimensions($s-sprites, $name)
@@ -0,0 +1,22 @@
1
+ /* BASIC TABLES STYLES */
2
+ table.standard-table
3
+ caption
4
+ td, th
5
+ // generic stye of every kind of cells
6
+ &.center
7
+ text-align: center
8
+ &.right
9
+ text-align: right
10
+ thead
11
+ tr
12
+ th
13
+ &.short
14
+ &.medium
15
+ &.long
16
+ tbody
17
+ tr
18
+ th
19
+ td
20
+ tfooter
21
+ tr
22
+ td
@@ -0,0 +1,4 @@
1
+ /* NAME: This is a module */
2
+ .my-example-module
3
+ // remember, build the structure first, leave it empty and keep maintained!
4
+ // it will help you in the future
@@ -0,0 +1,2 @@
1
+ /* SECTION: home page */
2
+ #homepage-section
@@ -1,22 +1,50 @@
1
+ require 'uri'
1
2
  require 'dragonfly'
2
- app = Dragonfly[:images]
3
+ begin
4
+ require 'rack/cache'
5
+ rescue LoadError => e
6
+ puts "Couldn't find rack-cache - make sure you have it in your Gemfile:"
7
+ puts " gem 'rack-cache', :require => 'rack/cache'"
8
+ puts " or configure dragonfly manually instead of using 'dragonfly/rails/images'"
9
+ raise e
10
+ end
3
11
 
4
- app.configure_with(:imagemagick)
12
+ app = Dragonfly[:images]
5
13
  app.configure_with(:rails)
6
- if Rails.env.production?
14
+ app.configure_with(:imagemagick)
15
+
16
+ if defined?(ActiveRecord::Base)
17
+ app.define_macro(ActiveRecord::Base, :image_accessor)
18
+ app.define_macro(ActiveRecord::Base, :file_accessor)
19
+ end
20
+
21
+ rack_cache_already_inserted = Rails.application.config.action_controller.perform_caching && Rails.application.config.action_dispatch.rack_cache
22
+
23
+ Rails.application.middleware.insert 0, Rack::Cache, {
24
+ :verbose => true,
25
+ :metastore => URI.encode("file:#{Rails.root}/tmp/dragonfly/cache/meta"), # URI encoded in case of spaces
26
+ :entitystore => URI.encode("file:#{Rails.root}/tmp/dragonfly/cache/body")
27
+ } unless rack_cache_already_inserted
28
+
29
+ Rails.application.middleware.insert_after Rack::Cache, Dragonfly::Middleware, :images
30
+
31
+ class AssetThumb < ActiveRecord::Base
32
+ attr_accessible :job, :uid
33
+ before_destroy do |thumb|
34
+ Dragonfly[:images].datastore.destroy(thumb.uid)
35
+ end
36
+ end
37
+
38
+ if ENV['S3_BUCKET']
7
39
  app.cache_duration = 3600*24*365*3
8
40
  app.configure do |c|
9
41
  c.define_url do |app, job, opts|
10
42
  thumb = AssetThumb.find_by_job(job.serialize)
11
- if thumb
12
- app.datastore.url_for(thumb.uid)
13
- else
14
- app.server.url_for(job)
43
+ if !thumb
44
+ uid = job.store
45
+ thumb = AssetThumb.create!(uid: uid, job: job.serialize)
15
46
  end
16
- end
17
- c.server.before_serve do |job, env|
18
- uid = job.store
19
- AssetThumb.create!(uid: uid, job: job.serialize)
47
+ app.datastore.url_for(thumb.uid)
20
48
  end
21
49
  end
22
50
  app.datastore = Dragonfly::DataStorage::S3DataStore.new
@@ -28,5 +56,3 @@ if Rails.env.production?
28
56
  end
29
57
  end
30
58
 
31
- app.define_macro(ActiveRecord::Base, :image_accessor)
32
- app.define_macro(ActiveRecord::Base, :file_accessor)
@@ -1,6 +1,6 @@
1
1
  module ActiveAdmin
2
2
  module Generator
3
- VERSION = "0.0.12"
3
+ VERSION = "0.0.13"
4
4
  end
5
5
  end
6
6
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activeadmin-generator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.12
4
+ version: 0.0.13
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-14 00:00:00.000000000 Z
12
+ date: 2013-03-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -136,21 +136,24 @@ files:
136
136
  - lib/active_admin/generator/cli.rb
137
137
  - lib/active_admin/generator/templates/app/assets/fonts/.empty_directory
138
138
  - lib/active_admin/generator/templates/app/assets/images/.empty_directory
139
+ - lib/active_admin/generator/templates/app/assets/images/s/credits.png
139
140
  - lib/active_admin/generator/templates/app/assets/javascripts/application.js.coffee
141
+ - lib/active_admin/generator/templates/app/assets/stylesheets/_layout.css.sass
142
+ - lib/active_admin/generator/templates/app/assets/stylesheets/_site_colors.css.sass
143
+ - lib/active_admin/generator/templates/app/assets/stylesheets/_site_mixins.css.sass
140
144
  - lib/active_admin/generator/templates/app/assets/stylesheets/active_admin.css.sass
141
145
  - lib/active_admin/generator/templates/app/assets/stylesheets/application.css.sass
146
+ - lib/active_admin/generator/templates/app/assets/stylesheets/basic/_cms.css.sass
147
+ - lib/active_admin/generator/templates/app/assets/stylesheets/basic/_config.css.sass
142
148
  - lib/active_admin/generator/templates/app/assets/stylesheets/basic/_fonts.css.sass
143
- - lib/active_admin/generator/templates/app/assets/stylesheets/basic/_layout.css.sass
144
- - lib/active_admin/generator/templates/app/assets/stylesheets/basic/_sprites.css.sass
145
- - lib/active_admin/generator/templates/app/assets/stylesheets/lib/_colors.css.sass
146
- - lib/active_admin/generator/templates/app/assets/stylesheets/lib/_mixins.css.sass
147
- - lib/active_admin/generator/templates/app/assets/stylesheets/lib/_variables.css.sass
148
- - lib/active_admin/generator/templates/app/assets/stylesheets/modules/.empty_directory
149
- - lib/active_admin/generator/templates/app/assets/stylesheets/sections/.empty_directory
150
- - lib/active_admin/generator/templates/app/assets/stylesheets/themes/.empty_directory
149
+ - lib/active_admin/generator/templates/app/assets/stylesheets/basic/_forms.css.sass
150
+ - lib/active_admin/generator/templates/app/assets/stylesheets/basic/_media-queries.css.sass
151
+ - lib/active_admin/generator/templates/app/assets/stylesheets/basic/_mixins.css.sass
152
+ - lib/active_admin/generator/templates/app/assets/stylesheets/basic/_tables.css.sass
153
+ - lib/active_admin/generator/templates/app/assets/stylesheets/modules/_module_example.css.sass
154
+ - lib/active_admin/generator/templates/app/assets/stylesheets/sections/_home.css.sass
151
155
  - lib/active_admin/generator/templates/app/controllers/application_controller.rb
152
156
  - lib/active_admin/generator/templates/app/controllers/static_controller.rb
153
- - lib/active_admin/generator/templates/app/models/asset_thumb.rb
154
157
  - lib/active_admin/generator/templates/app/views/layouts/application.html.slim
155
158
  - lib/active_admin/generator/templates/app/views/shared/_flash_messages.html.slim
156
159
  - lib/active_admin/generator/templates/app/views/shared/_footer.html.slim
@@ -193,3 +196,4 @@ signing_key:
193
196
  specification_version: 3
194
197
  summary: Generate ActiveAdmin projects
195
198
  test_files: []
199
+ has_rdoc:
@@ -1,7 +0,0 @@
1
- /* Layout */
2
-
3
- body
4
- font-family: Helvetica, sans-serif
5
-
6
- footer.page-footer
7
-
@@ -1,6 +0,0 @@
1
- /* Sprites */
2
-
3
- // $experimental-support-for-svg: true
4
- // $s-layout: smart
5
- // @import sprites/*.png
6
-
@@ -1,4 +0,0 @@
1
- class AssetThumb < ActiveRecord::Base
2
- attr_accessible :job, :uid
3
- end
4
-