Skip to content

Commit d6b2e46

Browse files
committed
add first specs
1 parent 6761bdb commit d6b2e46

File tree

84 files changed

+732
-732
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+732
-732
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ test/dummy/.sass-cache
99
*.swp
1010
*.swo
1111
*~
12+
.byebug_history

.travis.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
language: ruby
2+
rvm:
3+
- 2.3.0
4+
services:
5+
- postgresql
6+
addons:
7+
postgresql: "9.2"
8+
script:
9+
- bundle exec rspec
10+
before_script:
11+
- cp spec/internal/config/database.yml.travis spec/internal/config/database.yml

Gemfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ gemspec
99
# your gemspec. These might include edge Rails or gems from your path or
1010
# Git. Remember to move these dependencies to your gemspec before releasing
1111
# your gem to rubygems.org.
12+
gem 'kms', github: 'webgradus/kms'
1213

1314
# To use a debugger
14-
# gem 'byebug', group: [:development, :test]
15+
gem 'byebug', group: [:development, :test]

Gemfile.lock

Lines changed: 249 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,249 @@
1+
GIT
2+
remote: git://github.com/webgradus/kms.git
3+
revision: 30360b932c98a20d028ba251b135cfc9131b9218
4+
specs:
5+
kms (0.7.0)
6+
active_model_serializers
7+
ancestry
8+
angular-rails-templates (~> 1.0.0)
9+
bower-rails (~> 0.9.1)
10+
cancancan (~> 1.9)
11+
carrierwave (~> 1.0.0)
12+
devise
13+
dragonfly (~> 1.0.7)
14+
less-rails
15+
liquor
16+
pg
17+
rails (~> 5.0.0)
18+
russian
19+
slim-rails
20+
textacular (~> 4.0.0)
21+
therubyracer
22+
23+
PATH
24+
remote: .
25+
specs:
26+
kms_models (0.7.0)
27+
friendly_id (~> 5.0.0)
28+
kms (>= 0.6.0)
29+
30+
GEM
31+
remote: https://rubygems.org/
32+
specs:
33+
actioncable (5.0.1)
34+
actionpack (= 5.0.1)
35+
nio4r (~> 1.2)
36+
websocket-driver (~> 0.6.1)
37+
actionmailer (5.0.1)
38+
actionpack (= 5.0.1)
39+
actionview (= 5.0.1)
40+
activejob (= 5.0.1)
41+
mail (~> 2.5, >= 2.5.4)
42+
rails-dom-testing (~> 2.0)
43+
actionpack (5.0.1)
44+
actionview (= 5.0.1)
45+
activesupport (= 5.0.1)
46+
rack (~> 2.0)
47+
rack-test (~> 0.6.3)
48+
rails-dom-testing (~> 2.0)
49+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
50+
actionview (5.0.1)
51+
activesupport (= 5.0.1)
52+
builder (~> 3.1)
53+
erubis (~> 2.7.0)
54+
rails-dom-testing (~> 2.0)
55+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
56+
active_model_serializers (0.10.4)
57+
actionpack (>= 4.1, < 6)
58+
activemodel (>= 4.1, < 6)
59+
case_transform (>= 0.2)
60+
jsonapi (= 0.1.1.beta6)
61+
activejob (5.0.1)
62+
activesupport (= 5.0.1)
63+
globalid (>= 0.3.6)
64+
activemodel (5.0.1)
65+
activesupport (= 5.0.1)
66+
activerecord (5.0.1)
67+
activemodel (= 5.0.1)
68+
activesupport (= 5.0.1)
69+
arel (~> 7.0)
70+
activesupport (5.0.1)
71+
concurrent-ruby (~> 1.0, >= 1.0.2)
72+
i18n (~> 0.7)
73+
minitest (~> 5.1)
74+
tzinfo (~> 1.1)
75+
addressable (2.5.0)
76+
public_suffix (~> 2.0, >= 2.0.2)
77+
ancestry (2.2.2)
78+
activerecord (>= 3.0.0)
79+
angular-rails-templates (1.0.2)
80+
railties (>= 4.2, < 6)
81+
sprockets (>= 3.0, < 5)
82+
tilt
83+
arel (7.1.4)
84+
bcrypt (3.1.11)
85+
bower-rails (0.9.2)
86+
builder (3.2.3)
87+
byebug (9.0.6)
88+
cancancan (1.15.0)
89+
carrierwave (1.0.0)
90+
activemodel (>= 4.0.0)
91+
activesupport (>= 4.0.0)
92+
mime-types (>= 1.16)
93+
case_transform (0.2)
94+
activesupport
95+
combustion (0.5.5)
96+
activesupport (>= 3.0.0)
97+
railties (>= 3.0.0)
98+
thor (>= 0.14.6)
99+
commonjs (0.2.7)
100+
concurrent-ruby (1.0.4)
101+
devise (4.2.0)
102+
bcrypt (~> 3.0)
103+
orm_adapter (~> 0.1)
104+
railties (>= 4.1.0, < 5.1)
105+
responders
106+
warden (~> 1.2.3)
107+
diff-lcs (1.3)
108+
dragonfly (1.0.12)
109+
addressable (~> 2.3)
110+
multi_json (~> 1.0)
111+
rack (>= 1.3.0)
112+
erubis (2.7.0)
113+
factory_girl (4.8.0)
114+
activesupport (>= 3.0.0)
115+
factory_girl_rails (4.8.0)
116+
factory_girl (~> 4.8.0)
117+
railties (>= 3.0.0)
118+
friendly_id (5.0.5)
119+
activerecord (>= 4.0.0)
120+
globalid (0.3.7)
121+
activesupport (>= 4.1.0)
122+
i18n (0.8.0)
123+
jsonapi (0.1.1.beta6)
124+
jsonapi-parser (= 0.1.1.beta3)
125+
jsonapi-renderer (= 0.1.1.beta1)
126+
jsonapi-parser (0.1.1.beta3)
127+
jsonapi-renderer (0.1.1.beta1)
128+
less (2.6.0)
129+
commonjs (~> 0.2.7)
130+
less-rails (2.8.0)
131+
actionpack (>= 4.0)
132+
less (~> 2.6.0)
133+
sprockets (> 2, < 4)
134+
tilt
135+
libv8 (3.16.14.17)
136+
liquor (1.0.0)
137+
loofah (2.0.3)
138+
nokogiri (>= 1.5.9)
139+
mail (2.6.4)
140+
mime-types (>= 1.16, < 4)
141+
method_source (0.8.2)
142+
mime-types (3.1)
143+
mime-types-data (~> 3.2015)
144+
mime-types-data (3.2016.0521)
145+
mini_portile2 (2.1.0)
146+
minitest (5.10.1)
147+
multi_json (1.12.1)
148+
nio4r (1.2.1)
149+
nokogiri (1.7.0.1)
150+
mini_portile2 (~> 2.1.0)
151+
orm_adapter (0.5.0)
152+
pg (0.19.0)
153+
public_suffix (2.0.5)
154+
rack (2.0.1)
155+
rack-test (0.6.3)
156+
rack (>= 1.0)
157+
rails (5.0.1)
158+
actioncable (= 5.0.1)
159+
actionmailer (= 5.0.1)
160+
actionpack (= 5.0.1)
161+
actionview (= 5.0.1)
162+
activejob (= 5.0.1)
163+
activemodel (= 5.0.1)
164+
activerecord (= 5.0.1)
165+
activesupport (= 5.0.1)
166+
bundler (>= 1.3.0, < 2.0)
167+
railties (= 5.0.1)
168+
sprockets-rails (>= 2.0.0)
169+
rails-dom-testing (2.0.2)
170+
activesupport (>= 4.2.0, < 6.0)
171+
nokogiri (~> 1.6)
172+
rails-html-sanitizer (1.0.3)
173+
loofah (~> 2.0)
174+
railties (5.0.1)
175+
actionpack (= 5.0.1)
176+
activesupport (= 5.0.1)
177+
method_source
178+
rake (>= 0.8.7)
179+
thor (>= 0.18.1, < 2.0)
180+
rake (12.0.0)
181+
ref (2.0.0)
182+
responders (2.3.0)
183+
railties (>= 4.2.0, < 5.1)
184+
rspec-core (3.5.4)
185+
rspec-support (~> 3.5.0)
186+
rspec-expectations (3.5.0)
187+
diff-lcs (>= 1.2.0, < 2.0)
188+
rspec-support (~> 3.5.0)
189+
rspec-mocks (3.5.0)
190+
diff-lcs (>= 1.2.0, < 2.0)
191+
rspec-support (~> 3.5.0)
192+
rspec-rails (3.5.2)
193+
actionpack (>= 3.0)
194+
activesupport (>= 3.0)
195+
railties (>= 3.0)
196+
rspec-core (~> 3.5.0)
197+
rspec-expectations (~> 3.5.0)
198+
rspec-mocks (~> 3.5.0)
199+
rspec-support (~> 3.5.0)
200+
rspec-support (3.5.0)
201+
russian (0.6.0)
202+
i18n (>= 0.5.0)
203+
shoulda-matchers (3.1.1)
204+
activesupport (>= 4.0.0)
205+
slim (3.0.7)
206+
temple (~> 0.7.6)
207+
tilt (>= 1.3.3, < 2.1)
208+
slim-rails (3.1.1)
209+
actionpack (>= 3.1)
210+
railties (>= 3.1)
211+
slim (~> 3.0)
212+
sprockets (3.7.1)
213+
concurrent-ruby (~> 1.0)
214+
rack (> 1, < 3)
215+
sprockets-rails (3.2.0)
216+
actionpack (>= 4.0)
217+
activesupport (>= 4.0)
218+
sprockets (>= 3.0.0)
219+
temple (0.7.7)
220+
textacular (4.0.1)
221+
activerecord (>= 3.0, < 5.1)
222+
therubyracer (0.12.3)
223+
libv8 (~> 3.16.14.15)
224+
ref
225+
thor (0.19.4)
226+
thread_safe (0.3.5)
227+
tilt (2.0.6)
228+
tzinfo (1.2.2)
229+
thread_safe (~> 0.1)
230+
warden (1.2.7)
231+
rack (>= 1.0)
232+
websocket-driver (0.6.5)
233+
websocket-extensions (>= 0.1.0)
234+
websocket-extensions (0.1.2)
235+
236+
PLATFORMS
237+
ruby
238+
239+
DEPENDENCIES
240+
byebug
241+
combustion (~> 0.5.4)
242+
factory_girl_rails (~> 4.8)
243+
kms!
244+
kms_models!
245+
rspec-rails (~> 3.5, >= 3.5.0)
246+
shoulda-matchers (~> 3.1)
247+
248+
BUNDLED WITH
249+
1.12.5

app/assets/javascripts/kms_models/application/controllers/entries_controller.coffee renamed to app/assets/javascripts/kms_models/application/controllers/entries_controller.coffee.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ EntriesController = ($scope, $state, Restangular, $stateParams, Alertify, Errors
8181
Alertify.error(ErrorsService.prepareErrorsString(response.data.errors))
8282

8383
$scope.destroy = (entry)->
84-
if(confirm('Вы уверены?'))
84+
if(confirm('<%= I18n.t(:are_you_sure) %>'))
8585
entry.remove().then ->
8686
$scope.entries = _.without($scope.entries, entry)
8787

app/assets/javascripts/kms_models/application/controllers/fields_controller.coffee.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ FieldsController = ($scope, $state, Restangular, $stateParams) ->
3030

3131
$scope.addField = ->
3232
if $scope.field.name and $scope.field.type
33-
$scope.model.fields.push($scope.field)
33+
$scope.model.fields_attributes.push($scope.field)
3434
$scope.field = {}
3535

3636
$scope.removeField = (field)->
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ModelsController = ($scope, $state, Restangular, $stateParams) ->
1+
ModelsController = ($scope, $state, Restangular, $stateParams, Alertify, ErrorsService) ->
22
$scope.store = Restangular.all('models')
33

44
Restangular.all('users').customGET('kms_user').then (current_user) ->
@@ -12,9 +12,9 @@ ModelsController = ($scope, $state, Restangular, $stateParams) ->
1212
$scope.store.get($stateParams.id).then (model)->
1313
$scope.model = model
1414
else
15-
$scope.model = {fields: []}
15+
$scope.model = {fields_attributes: []}
1616

17-
$scope.$watchCollection 'model.fields', (newFields, oldFields) ->
17+
$scope.$watchCollection 'model.fields_attributes', (newFields, oldFields) ->
1818
if newFields and newFields.length > 0 and oldFields and oldFields.length == 0
1919
$scope.model.label_field =newFields[0].liquor_name
2020

@@ -23,20 +23,20 @@ ModelsController = ($scope, $state, Restangular, $stateParams) ->
2323
# for adding to Menu - better to render resources via js
2424
window.location.reload()
2525
#$state.go('models')
26-
,->
27-
console.log('bug')
26+
,(response)->
27+
Alertify.error(ErrorsService.prepareErrorsString(response.data.errors))
2828

2929
$scope.update = ->
3030
$scope.model.put().then ->
3131
$state.go('models')
32-
,->
33-
console.log('bug')
32+
,(response)->
33+
Alertify.error(ErrorsService.prepareErrorsString(response.data.errors))
3434

3535
$scope.destroy = (model)->
36-
if confirm('Вы уверены?')
36+
if confirm('<%= I18n.t(:are_you_sure) %>')
3737
model.remove().then ->
3838
window.location.reload()
3939

4040

4141
angular.module('KMS')
42-
.controller('ModelsController', ['$scope', '$state', 'Restangular', '$stateParams', ModelsController])
42+
.controller('ModelsController', ['$scope', '$state', 'Restangular', '$stateParams', 'Alertify', 'ErrorsService', ModelsController])

app/assets/javascripts/templates/models/fields.html.slim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
tr
55
th colspan="4" = Kms::Model.human_attribute_name(:fields)
66
tbody
7-
tr ng-repeat="field in model.fields" ng-hide="field._destroy"
7+
tr ng-repeat="field in model.fields_attributes" ng-hide="field._destroy"
88
td
99
| {{ field.name }}
1010
td
@@ -17,7 +17,7 @@
1717
.btn-group.pull-right
1818
a.btn.btn-sm.btn-danger ng-click="removeField(field)"
1919
i.fa.fa-times
20-
tr ng-hide="model.fields.length > 0"
20+
tr ng-hide="model.fields_attributes.length > 0"
2121
td
2222
i = I18n.t(:no_fields_yet)
2323
.row

app/assets/javascripts/templates/models/form.html.slim

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,7 @@
88
.form-group
99
label for="label_field" = Kms::Model.human_attribute_name(:label_field)
1010
select#label_field.form-control ng-model="model.label_field" ng-options="field.liquor_name as field.name for field in model.fields"
11+
.form-group
12+
label for="allow_creation_using_form" style="margin-right:10px;"
13+
= Kms::Model.human_attribute_name(:allow_creation_using_form)
14+
toggle-switch ng-model="model.allow_creation_using_form" on-label=I18n.t(:yes_word) off-label=I18n.t(:no_word)

0 commit comments

Comments
 (0)