iatelier 0.1.8 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/iatelier/assets/javascripts/iatelier-analog.js +7005 -7008
- data/lib/iatelier/assets/javascripts/selectize.js +6455 -6455
- data/lib/iatelier/config/routes.rb +5 -9
- data/lib/iatelier/configuration.rb +12 -0
- data/lib/iatelier/controllers/books/_db_connector.rb +13 -0
- data/lib/iatelier/controllers/books/create.rb +2 -1
- data/lib/iatelier/controllers/books/edit.rb +4 -1
- data/lib/iatelier/controllers/books/manage.rb +2 -0
- data/lib/iatelier/controllers/books/new.rb +4 -2
- data/lib/iatelier/controllers/books/update.rb +2 -1
- data/lib/iatelier/models/Bundle.rb +17 -0
- data/lib/iatelier/models/book.rb +101 -23
- data/lib/iatelier/models/people.rb +1 -1
- data/lib/iatelier/templates/application.html.erb +3 -4
- data/lib/iatelier/templates/books/_engine.html.haml +5 -2
- data/lib/iatelier/templates/books/dimension/_timestamp.html.haml +11 -0
- data/lib/iatelier/templates/books/edit.html.haml +1 -1
- data/lib/iatelier/templates/books/new.html.haml +1 -1
- data/lib/iatelier/version.rb +1 -1
- data/lib/iatelier.rb +15 -4
- data/mix-manifest.json +6 -0
- data/{lib/iatelier/assets → src}/js/iatelier-analog.js +6 -7
- data/{lib/iatelier/webpack.mix.js → webpack.mix.js} +4 -4
- metadata +78 -76
- data/lib/iatelier/Users/captainhusaynpinguin/Documents/ruby/iatelier/public/assets/js/analog.js +0 -15347
- data/lib/iatelier/Users/captainhusaynpinguin/Documents/ruby/iatelier/public/assets/js/selectize.js +0 -12672
- data/lib/iatelier/mix-manifest.json +0 -6
- /data/{lib/iatelier/package.json → package.json} +0 -0
- /data/{lib/iatelier/assets → src}/js/selectize.js +0 -0
- /data/{lib/iatelier/assets → src}/sass/backend.scss +0 -0
- /data/{lib/iatelier/assets → src}/sass/blaze/blaze.colors.scss +0 -0
- /data/{lib/iatelier/assets → src}/sass/blaze/blaze.scss +0 -0
- /data/{lib/iatelier/assets → src}/sass/blaze/components.addresses.scss +0 -0
- /data/{lib/iatelier/assets → src}/sass/blaze/components.alerts.scss +0 -0
- /data/{lib/iatelier/assets → src}/sass/blaze/components.avatars.scss +0 -0
- /data/{lib/iatelier/assets → src}/sass/blaze/components.badges.scss +0 -0
- /data/{lib/iatelier/assets → src}/sass/blaze/components.breadcrumbs.scss +0 -0
- /data/{lib/iatelier/assets → src}/sass/blaze/components.bubbles.scss +0 -0
- /data/{lib/iatelier/assets → src}/sass/blaze/components.buttons.scss +0 -0
- /data/{lib/iatelier/assets → src}/sass/blaze/components.calendars.scss +0 -0
- /data/{lib/iatelier/assets → src}/sass/blaze/components.cards.scss +0 -0
- /data/{lib/iatelier/assets → src}/sass/blaze/components.headings.scss +0 -0
- /data/{lib/iatelier/assets → src}/sass/blaze/components.hints.scss +0 -0
- /data/{lib/iatelier/assets → src}/sass/blaze/components.input-groups.scss +0 -0
- /data/{lib/iatelier/assets → src}/sass/blaze/components.inputs.scss +0 -0
- /data/{lib/iatelier/assets → src}/sass/blaze/components.links.scss +0 -0
- /data/{lib/iatelier/assets → src}/sass/blaze/components.lists.scss +0 -0
- /data/{lib/iatelier/assets → src}/sass/blaze/components.navs.scss +0 -0
- /data/{lib/iatelier/assets → src}/sass/blaze/components.overlays.scss +0 -0
- /data/{lib/iatelier/assets → src}/sass/blaze/components.pagination.scss +0 -0
- /data/{lib/iatelier/assets → src}/sass/blaze/components.progress.scss +0 -0
- /data/{lib/iatelier/assets → src}/sass/blaze/components.ranges.scss +0 -0
- /data/{lib/iatelier/assets → src}/sass/blaze/components.tables.scss +0 -0
- /data/{lib/iatelier/assets → src}/sass/blaze/components.tabs.scss +0 -0
- /data/{lib/iatelier/assets → src}/sass/blaze/components.tags.scss +0 -0
- /data/{lib/iatelier/assets → src}/sass/blaze/components.toggles.scss +0 -0
- /data/{lib/iatelier/assets → src}/sass/blaze/components.tooltips.scss +0 -0
- /data/{lib/iatelier/assets → src}/sass/blaze/components.trees.scss +0 -0
- /data/{lib/iatelier/assets → src}/sass/blaze/components.typography.scss +0 -0
- /data/{lib/iatelier/assets → src}/sass/blaze/generics.global.scss +0 -0
- /data/{lib/iatelier/assets → src}/sass/blaze/mixins/_components.alerts.scss +0 -0
- /data/{lib/iatelier/assets → src}/sass/blaze/mixins/_components.badges.scss +0 -0
- /data/{lib/iatelier/assets → src}/sass/blaze/mixins/_components.buttons.scss +0 -0
- /data/{lib/iatelier/assets → src}/sass/blaze/mixins/_components.inputs.scss +0 -0
- /data/{lib/iatelier/assets → src}/sass/blaze/mixins/_components.links.scss +0 -0
- /data/{lib/iatelier/assets → src}/sass/blaze/mixins/_components.lists.scss +0 -0
- /data/{lib/iatelier/assets → src}/sass/blaze/mixins/_components.navs.scss +0 -0
- /data/{lib/iatelier/assets → src}/sass/blaze/mixins/_components.ranges.scss +0 -0
- /data/{lib/iatelier/assets → src}/sass/blaze/mixins/_components.tabs.scss +0 -0
- /data/{lib/iatelier/assets → src}/sass/blaze/mixins/_components.toggles.scss +0 -0
- /data/{lib/iatelier/assets → src}/sass/blaze/mixins/_components.typography.scss +0 -0
- /data/{lib/iatelier/assets → src}/sass/blaze/mixins/_objects.containers.scss +0 -0
- /data/{lib/iatelier/assets → src}/sass/blaze/mixins/_objects.grid.scss +0 -0
- /data/{lib/iatelier/assets → src}/sass/blaze/mixins/_settings.global.scss +0 -0
- /data/{lib/iatelier/assets → src}/sass/blaze/mixins/_tools.mediaqueries.scss +0 -0
- /data/{lib/iatelier/assets → src}/sass/blaze/mixins/_utilities.alignment.scss +0 -0
- /data/{lib/iatelier/assets → src}/sass/blaze/mixins/_utilities.boxing.scss +0 -0
- /data/{lib/iatelier/assets → src}/sass/blaze/mixins/_utilities.visibility.scss +0 -0
- /data/{lib/iatelier/assets → src}/sass/blaze/objects.containers.scss +0 -0
- /data/{lib/iatelier/assets → src}/sass/blaze/objects.drawers.scss +0 -0
- /data/{lib/iatelier/assets → src}/sass/blaze/objects.forms.scss +0 -0
- /data/{lib/iatelier/assets → src}/sass/blaze/objects.grid.responsive.scss +0 -0
- /data/{lib/iatelier/assets → src}/sass/blaze/objects.grid.scss +0 -0
- /data/{lib/iatelier/assets → src}/sass/blaze/objects.images.scss +0 -0
- /data/{lib/iatelier/assets → src}/sass/blaze/objects.media.scss +0 -0
- /data/{lib/iatelier/assets → src}/sass/blaze/objects.modals.scss +0 -0
- /data/{lib/iatelier/assets → src}/sass/blaze/objects.panels.scss +0 -0
- /data/{lib/iatelier/assets → src}/sass/blaze/themes/blaze.example.scss +0 -0
- /data/{lib/iatelier/assets → src}/sass/blaze/utilities.alignment.scss +0 -0
- /data/{lib/iatelier/assets → src}/sass/blaze/utilities.boxing.scss +0 -0
- /data/{lib/iatelier/assets → src}/sass/blaze/utilities.elevation.scss +0 -0
- /data/{lib/iatelier/assets → src}/sass/blaze/utilities.sizes.scss +0 -0
- /data/{lib/iatelier/assets → src}/sass/blaze/utilities.visibility.scss +0 -0
- /data/{lib/iatelier/assets → src}/sass/iatelier.scss +0 -0
- /data/{lib/iatelier/assets → src}/sass/selectize.scss +0 -0
- /data/{lib/iatelier/assets → src}/sass/views/master.scss +0 -0
@@ -3,12 +3,8 @@
|
|
3
3
|
#
|
4
4
|
# Example:
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
patch '/:book_type/:id', to: 'books#update'
|
12
|
-
end
|
13
|
-
|
14
|
-
get '/*', to: Iatelier::Controllers::Ileaf
|
6
|
+
get '/:database/:book_type', to: 'books#manage'
|
7
|
+
get '/:database/:book_type/new', to: 'books#new'
|
8
|
+
post '/:database/:book_type', to: 'books#create'
|
9
|
+
get '/:database/:book_type/:id/edit', to: 'books#edit'
|
10
|
+
patch '/:database/:book_type/:id', to: 'books#update'
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module Iatelier
|
2
|
+
class Configuration
|
3
|
+
attr_accessor :atelier_name, :atelier_url, :storage_dir
|
4
|
+
def initialize
|
5
|
+
@atelier_name = nil
|
6
|
+
@atelier_url = nil
|
7
|
+
@storage_dir = './storage/books/'
|
8
|
+
@admin_username = 'admin'
|
9
|
+
@admin_password = 'yup-thatsthat'
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Iatelier
|
2
|
+
module Controllers
|
3
|
+
module Books
|
4
|
+
module DbConnector
|
5
|
+
def set_database database
|
6
|
+
tmp_config = ActiveRecord::Base.connection_config
|
7
|
+
tmp_config[:database] = database
|
8
|
+
ActiveRecord::Base.establish_connection tmp_config
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -3,8 +3,9 @@ module Iatelier
|
|
3
3
|
module Books
|
4
4
|
class Create
|
5
5
|
include Iatelier::Action
|
6
|
-
|
6
|
+
include Iatelier::Controllers::Books::DbConnector
|
7
7
|
def call(params)
|
8
|
+
self.set_database params[:database]
|
8
9
|
@book = Object.const_get(params[:book_type].capitalize).new
|
9
10
|
@book.save
|
10
11
|
@book.create(params)
|
@@ -3,8 +3,11 @@ module Iatelier
|
|
3
3
|
module Books
|
4
4
|
class Edit
|
5
5
|
include Iatelier::Action
|
6
|
-
|
6
|
+
include Iatelier::Controllers::Books::DbConnector
|
7
|
+
expose :book, :database
|
7
8
|
def call(params)
|
9
|
+
@database = params[:database]
|
10
|
+
self.set_database database
|
8
11
|
@book = Object.const_get(params[:book_type].capitalize).find(params[:id])
|
9
12
|
end
|
10
13
|
end
|
@@ -3,8 +3,10 @@ module Iatelier
|
|
3
3
|
module Books
|
4
4
|
class Manage
|
5
5
|
include Iatelier::Action
|
6
|
+
include Iatelier::Controllers::Books::DbConnector
|
6
7
|
expose :books
|
7
8
|
def call(params)
|
9
|
+
self.set_database params[:database]
|
8
10
|
@books = Object.const_get(params[:book_type].capitalize).all
|
9
11
|
end
|
10
12
|
end
|
@@ -3,9 +3,11 @@ module Iatelier
|
|
3
3
|
module Books
|
4
4
|
class New
|
5
5
|
include Iatelier::Action
|
6
|
-
|
7
|
-
expose :book_type
|
6
|
+
include Iatelier::Controllers::Books::DbConnector
|
7
|
+
expose :book, :book_type, :database
|
8
8
|
def call(params)
|
9
|
+
@database = params[:database]
|
10
|
+
self.set_database database
|
9
11
|
@book_type = params[:book_type].capitalize;
|
10
12
|
@book = Object.const_get(@book_type).new
|
11
13
|
end
|
@@ -3,8 +3,9 @@ module Iatelier
|
|
3
3
|
module Books
|
4
4
|
class Update
|
5
5
|
include Iatelier::Action
|
6
|
-
|
6
|
+
include Iatelier::Controllers::Books::DbConnector
|
7
7
|
def call(params)
|
8
|
+
self.set_database params[:database]
|
8
9
|
@book = Object.const_get(params[:book_type].capitalize).find(params[:id])
|
9
10
|
@book.revise(params)
|
10
11
|
@book.save
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require_relative 'book'
|
2
|
+
|
3
|
+
class Bundleable < ApplicationRecord
|
4
|
+
belongs_to :bundle
|
5
|
+
belongs_to :bundleble, polymorphic: true
|
6
|
+
end
|
7
|
+
|
8
|
+
class Bundle < Book
|
9
|
+
@@dimensions = ['title', 'subtitle', 'description', 'slug', 'thumbnail', 'timestamp']
|
10
|
+
has_many :bundleables
|
11
|
+
self.table_name = "bundles"
|
12
|
+
|
13
|
+
def items(class_name)
|
14
|
+
@query = '`bundleables`.`bundle_id` = "' + self.id.to_s + '"'
|
15
|
+
Object::const_get(class_name).joins(:bundleables).where(@query)
|
16
|
+
end
|
17
|
+
end
|
data/lib/iatelier/models/book.rb
CHANGED
@@ -4,9 +4,12 @@ class Book < ActiveRecord::Base
|
|
4
4
|
self.abstract_class = true
|
5
5
|
|
6
6
|
@@dimensions = []
|
7
|
+
@@groupings = []
|
7
8
|
@@roles = []
|
8
9
|
|
9
|
-
|
10
|
+
@content_raw = ''
|
11
|
+
|
12
|
+
@namespace = nil
|
10
13
|
|
11
14
|
has_one :title, as: :titleable, class_name: 'Dimensions::Title'
|
12
15
|
has_one :slug, as: :slugable, class_name: 'Dimensions::Slug'
|
@@ -20,49 +23,73 @@ class Book < ActiveRecord::Base
|
|
20
23
|
|
21
24
|
has_many :peopleables, as: :peopleable, dependent: :destroy
|
22
25
|
has_many :peoples, through: :peopleables
|
23
|
-
|
26
|
+
|
27
|
+
has_many :bundleables, as: :bundleable, dependent: :destroy
|
28
|
+
has_many :bundles, through: :bundleables
|
29
|
+
|
24
30
|
accepts_nested_attributes_for :title, :slug, :subtitle, :description, :thumbnail, :timestamp
|
25
31
|
validates_associated :slug
|
32
|
+
|
33
|
+
attr_accessor :namespace
|
26
34
|
|
35
|
+
|
36
|
+
def kind
|
37
|
+
self.class.to_s
|
38
|
+
end
|
39
|
+
def uniq
|
40
|
+
self.class.to_s + self.id.to_s
|
41
|
+
end
|
42
|
+
|
27
43
|
def dimensions
|
44
|
+
@@dimensions
|
45
|
+
end
|
46
|
+
def self.dimensions
|
28
47
|
@@dimensions
|
29
48
|
end
|
30
49
|
|
31
|
-
|
50
|
+
def roles
|
51
|
+
@@roles
|
52
|
+
end
|
53
|
+
def self.roles
|
32
54
|
@@roles
|
33
55
|
end
|
56
|
+
|
57
|
+
def groupings
|
58
|
+
@@groupings
|
59
|
+
end
|
60
|
+
def self.groupings
|
61
|
+
@@groupings
|
62
|
+
end
|
34
63
|
|
35
64
|
def individuals requested_role
|
36
65
|
@query = '`peopleables`.`role` = "' + requested_role.to_s + '"'
|
37
66
|
self.peoples.includes(:peopleables).where(@query)
|
38
67
|
end
|
39
68
|
|
40
|
-
def
|
41
|
-
puts
|
69
|
+
def content_raw
|
70
|
+
puts 'trying to open content'
|
42
71
|
unless self.id.nil?
|
43
|
-
|
44
|
-
|
45
|
-
puts
|
46
|
-
if File.exists?
|
47
|
-
puts
|
48
|
-
|
72
|
+
puts 'id passed'
|
73
|
+
path = Iatelier.configuration.storage_dir + @namespace.to_s + self.class.name.downcase + '/' + self.id.to_s + '/main.md'
|
74
|
+
puts 'path is set to ' + path
|
75
|
+
if File.exists? path
|
76
|
+
puts 'reading content'
|
77
|
+
@content = File.open(path).read
|
49
78
|
else
|
50
|
-
|
79
|
+
@content = nil
|
51
80
|
end
|
52
81
|
else
|
53
|
-
|
82
|
+
@content = nil
|
54
83
|
end
|
55
84
|
end
|
56
85
|
|
57
|
-
def
|
58
|
-
|
59
|
-
markdown.render(self.content)
|
86
|
+
def self.with_all
|
87
|
+
self.includes(self.dimensions + self.groupings)
|
60
88
|
end
|
61
89
|
|
62
|
-
def
|
63
|
-
|
64
|
-
|
65
|
-
# self.save
|
90
|
+
def content
|
91
|
+
markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML, autolink: true, tables: true)
|
92
|
+
markdown.render(self.content_raw)
|
66
93
|
end
|
67
94
|
|
68
95
|
# def initialized
|
@@ -76,6 +103,7 @@ class Book < ActiveRecord::Base
|
|
76
103
|
# end
|
77
104
|
|
78
105
|
def create params
|
106
|
+
puts 'these are the stuff were going to add:' + @@dimensions.to_s
|
79
107
|
@@dimensions.each do |dimension|
|
80
108
|
method_name = 'setup_' + dimension
|
81
109
|
self.public_send(method_name.to_sym, params)
|
@@ -83,6 +111,7 @@ class Book < ActiveRecord::Base
|
|
83
111
|
self.save
|
84
112
|
sync_keywords params
|
85
113
|
sync_individuals params
|
114
|
+
sync_content params
|
86
115
|
end
|
87
116
|
|
88
117
|
def revise params
|
@@ -99,6 +128,7 @@ class Book < ActiveRecord::Base
|
|
99
128
|
end
|
100
129
|
sync_keywords params
|
101
130
|
sync_individuals params
|
131
|
+
sync_content params
|
102
132
|
end
|
103
133
|
|
104
134
|
def sync_keywords params
|
@@ -161,13 +191,61 @@ class Book < ActiveRecord::Base
|
|
161
191
|
self.build_title({value: params[:title]})
|
162
192
|
end
|
163
193
|
def revise_title params
|
164
|
-
self.title.
|
194
|
+
self.title.update(value: params[:title])
|
195
|
+
end
|
196
|
+
|
197
|
+
def setup_subtitle params
|
198
|
+
self.build_subtitle({value: params[:subtitle]})
|
199
|
+
end
|
200
|
+
def revise_title params
|
201
|
+
self.subtitle.update(value: params[:subtitle])
|
165
202
|
end
|
166
203
|
|
167
204
|
def setup_slug params
|
168
205
|
self.build_slug({value: params[:slug]})
|
169
206
|
end
|
170
207
|
def revise_slug params
|
171
|
-
self.slug.
|
208
|
+
self.slug.update(value: params[:slug])
|
209
|
+
end
|
210
|
+
|
211
|
+
def setup_thumbnail params
|
212
|
+
end
|
213
|
+
def revise_thumbnail params
|
214
|
+
end
|
215
|
+
|
216
|
+
def setup_timestamp params
|
217
|
+
puts 'setting up timestamp'
|
218
|
+
self.build_timestamp({
|
219
|
+
draft: params[:timestamp][:draft],
|
220
|
+
publish: params[:timestamp][:publish],
|
221
|
+
amend: params[:timestamp][:amend]
|
222
|
+
})
|
223
|
+
end
|
224
|
+
def revise_timestamp params
|
225
|
+
puts 'revising timestamp'
|
226
|
+
unless self.timestamp.nil?
|
227
|
+
puts 'we found some > updating'
|
228
|
+
self.timestamp.update({
|
229
|
+
draft: params[:timestamp][:draft],
|
230
|
+
publish: params[:timestamp][:publish],
|
231
|
+
amend: params[:timestamp][:amend]
|
232
|
+
})
|
233
|
+
else
|
234
|
+
puts 'initiating new ones!'
|
235
|
+
self.setup_timestamp params
|
236
|
+
end
|
237
|
+
end
|
238
|
+
|
239
|
+
def sync_content params
|
240
|
+
puts 'we are trying to sync the content = ' + params[:content]
|
241
|
+
path = Iatelier.configuration.storage_dir + params[:database].to_s + self.class.name.downcase + '/' + self.id.to_s
|
242
|
+
Dir.mkdir(path) unless File.exists?(path)
|
243
|
+
File.open(path + '/main.md', 'w+') do |file|
|
244
|
+
file.puts params[:content]
|
245
|
+
end
|
246
|
+
puts 'updating loc!!! ' + self.id.to_s
|
247
|
+
self.update(loc: self.id.to_s)
|
248
|
+
self.save
|
249
|
+
puts self.loc.to_s
|
172
250
|
end
|
173
|
-
end
|
251
|
+
end
|
@@ -11,10 +11,9 @@
|
|
11
11
|
@stack('description')
|
12
12
|
">
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
<link rel="stylesheet" href="/assets/iatelier.css">
|
14
|
+
|
15
|
+
<%= javascript "iatelier-analog.js" %>
|
16
|
+
<%= stylesheet "iatelier.css" %>
|
18
17
|
<!-- <link rel="stylesheet" href="/lil-plp/atelier/css/selectize.css"> -->
|
19
18
|
|
20
19
|
<meta name="csrf-token" content="{{ csrf_token() }}">
|
@@ -20,8 +20,8 @@
|
|
20
20
|
.form-box
|
21
21
|
%label Text
|
22
22
|
%textarea{:name => "content", :class => "text-editor pure-input-1 form-control", :type => "text", :placeholder => "Content of the book ..."}
|
23
|
-
-unless book.
|
24
|
-
= book.
|
23
|
+
-unless book.content_raw.nil?
|
24
|
+
= book.content_raw
|
25
25
|
%div{:class => "grid-large panel-edit"}
|
26
26
|
.form-box
|
27
27
|
= render :partial => 'grouping/keywords'
|
@@ -29,3 +29,6 @@
|
|
29
29
|
= render :partial => 'grouping/peoples'
|
30
30
|
.form-box
|
31
31
|
= render :partial => 'grouping/bundles'
|
32
|
+
.form-box
|
33
|
+
= render :partial => 'dimension/timestamp'
|
34
|
+
|
@@ -0,0 +1,11 @@
|
|
1
|
+
%header Dates
|
2
|
+
%div{:class => "c-card__item pure-control-group"}
|
3
|
+
.os-form-group
|
4
|
+
%label Draft:
|
5
|
+
%input{:class => "flatpickr form-control", :name => "timestamp[draft]", :type => "datetime-local", :value => book.timestamp.try(:draft)}
|
6
|
+
.os-form-group
|
7
|
+
%label Publish:
|
8
|
+
%input{:class => "flatpickr form-control", :name => "timestamp[publish]", :type => "datetime-local", :value => book.timestamp.try(:publish)}
|
9
|
+
.os-form-group
|
10
|
+
%label Amend:
|
11
|
+
%input{:class => "flatpickr form-control", :name => "timestamp[amend]", :type => "datetime-local", :value => book.timestamp.try(:amend)}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
%div
|
2
2
|
.todo adding errors here!
|
3
|
-
%form{:class => "atelier-main-form pure-form pure-form-aligned", :action => "/iatelier
|
3
|
+
%form{:class => "atelier-main-form pure-form pure-form-aligned", :action => "/iatelier/#{database}/#{book.class.name.downcase}/#{book.id}", :method => "POST", :enctype => "multipart/form-data"}
|
4
4
|
.form-actions
|
5
5
|
<button type="submit" class="btn btn-default">Edit</button>
|
6
6
|
<input type="hidden" name="_method" value="PATCH">
|
@@ -1,6 +1,6 @@
|
|
1
1
|
%div
|
2
2
|
.todo adding errors here!
|
3
|
-
%form{:class => "atelier-main-form pure-form pure-form-aligned", :action => "/iatelier
|
3
|
+
%form{:class => "atelier-main-form pure-form pure-form-aligned", :action => "/iatelier/#{database}/#{book.class.name.downcase}/#{book.id}", :method => "POST", :enctype => "multipart/form-data"}
|
4
4
|
.form-actions
|
5
5
|
<button type="submit" class="btn btn-default">Create</button>
|
6
6
|
%div
|
data/lib/iatelier/version.rb
CHANGED
data/lib/iatelier.rb
CHANGED
@@ -13,11 +13,22 @@ require 'hanami/assets'
|
|
13
13
|
require 'active_support/inflector'
|
14
14
|
# Dir[File.join(__dir__, 'iatelier/models/', '*.rb')].each { |file| require file }
|
15
15
|
# Dir[File.join(__dir__, 'iatelier/models/dimensions', '*.rb')].each { |file| require file }
|
16
|
-
require '
|
17
|
-
Gem.find_files('iatelier/models').each {|file| require file }
|
18
|
-
Gem.find_files('iatelier/models/dimensions').each {|file| require file }
|
16
|
+
require 'iatelier/models/application_record'
|
17
|
+
Gem.find_files('iatelier/models/*.rb').each {|file| require file }
|
18
|
+
Gem.find_files('iatelier/models/dimensions/*.rb').each {|file| require file }
|
19
|
+
|
20
|
+
require 'iatelier/configuration'
|
19
21
|
|
20
22
|
module Iatelier
|
23
|
+
class << self
|
24
|
+
attr_accessor :configuration
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.configure
|
28
|
+
self.configuration ||= Configuration.new
|
29
|
+
yield(configuration)
|
30
|
+
end
|
31
|
+
|
21
32
|
class Application < Hanami::Application
|
22
33
|
configure do
|
23
34
|
##
|
@@ -103,7 +114,7 @@ module Iatelier
|
|
103
114
|
#
|
104
115
|
# middleware.use Rack::Protection
|
105
116
|
middleware.use Rack::Auth::Basic, 'Welcome' do |username, password|
|
106
|
-
username ==
|
117
|
+
username == self.configuration.admin_username && password == self.configuration.admin_password
|
107
118
|
end
|
108
119
|
|
109
120
|
# Default format for the requests that don't specify an HTTP_ACCEPT header
|
data/mix-manifest.json
ADDED
@@ -0,0 +1,6 @@
|
|
1
|
+
{
|
2
|
+
"/lib/iatelier/assets/javascripts/iatelier-analog.js": "/lib/iatelier/assets/javascripts/iatelier-analog.js",
|
3
|
+
"/lib/iatelier/assets/stylesheets/selectize.css": "/lib/iatelier/assets/stylesheets/selectize.css",
|
4
|
+
"/lib/iatelier/assets/stylesheets/iatelier.css": "/lib/iatelier/assets/stylesheets/iatelier.css",
|
5
|
+
"/lib/iatelier/assets/javascripts/selectize.js": "/lib/iatelier/assets/javascripts/selectize.js"
|
6
|
+
}
|
@@ -1,5 +1,5 @@
|
|
1
|
-
var $ = jQuery = require("jquery");
|
2
|
-
window.$ = window.jQuery = $;
|
1
|
+
// var $ = jQuery = require("jquery");
|
2
|
+
// window.$ = window.jQuery = $;
|
3
3
|
// Window.$ = Window.jQuery = $
|
4
4
|
|
5
5
|
import './selectize.js';
|
@@ -17,10 +17,9 @@ $(".flatpickr").flatpickr({
|
|
17
17
|
});
|
18
18
|
*/
|
19
19
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
});
|
20
|
+
|
21
|
+
flatpickr(".flatpickr", {
|
22
|
+
enableTime: true,
|
23
|
+
dateFormat: "Y-m-d H:i",
|
25
24
|
});
|
26
25
|
|
@@ -11,9 +11,9 @@ const mix = require('laravel-mix');
|
|
11
11
|
|
|
12
12
|
*/
|
13
13
|
// mix.options({ processCssUrls: false })
|
14
|
-
mix.js('
|
15
|
-
.js('
|
16
|
-
.sass('
|
17
|
-
.sass('
|
14
|
+
mix.js('src/js/iatelier-analog.js', 'lib/iatelier/assets/javascripts')
|
15
|
+
.js('src/js/selectize.js', 'lib/iatelier/assets/javascripts')
|
16
|
+
.sass('src/sass/selectize.scss', 'lib/iatelier/assets/stylesheets')
|
17
|
+
.sass('src/sass/iatelier.scss', 'lib/iatelier/assets/stylesheets');
|
18
18
|
|
19
19
|
// mix.copy('node_modules/css-oldschool/src/fonts', 'public/fonts');
|