graph_starter 0.10.0 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/graph_starter/assets_controller.rb +16 -1
- data/app/views/graph_starter/assets/_body.html.slim +1 -13
- data/app/views/graph_starter/assets/_form.html.slim +7 -5
- data/app/views/graph_starter/assets/_images.html.slim +13 -0
- data/lib/graph_starter/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 47a9f8cc99f25f8bd774204ee058e875ae59796e
|
4
|
+
data.tar.gz: 7c764770c6b64a5f5a0df814930489a013846a94
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3851899c4e50fe3eed296ae8de286ea594ba6d2f311d9f4d6068771ef2944da7d3684c2f14a01fd002ccb8342ce5558b8fa392f5fb004ded4bc9a5d0b646ff4c
|
7
|
+
data.tar.gz: d50223200f167ab6b991c16a9a7f89c8981218cf5e80f04ab31897141dd0ae7d8abd347a428a69333be53255fb5baa58c9d3b5918efb561b06aea9142d52b7be
|
@@ -66,7 +66,7 @@ module GraphStarter
|
|
66
66
|
end
|
67
67
|
|
68
68
|
def edit
|
69
|
-
@asset =
|
69
|
+
@asset, @access_level = asset_with_access_level
|
70
70
|
|
71
71
|
render file: 'public/404.html', status: :not_found, layout: false if !@asset
|
72
72
|
end
|
@@ -75,6 +75,12 @@ module GraphStarter
|
|
75
75
|
@asset = asset
|
76
76
|
@asset.update(params[params[:model_slug].singularize])
|
77
77
|
|
78
|
+
if @asset.class.has_image?
|
79
|
+
@asset.image = Image.create(source: params[:image])
|
80
|
+
else @asset.has_images?
|
81
|
+
@asset.images << Image.create(source: params[:image])
|
82
|
+
end
|
83
|
+
|
78
84
|
redirect_to action: :edit
|
79
85
|
end
|
80
86
|
|
@@ -119,6 +125,15 @@ module GraphStarter
|
|
119
125
|
model_class_scope.where(uuid: params[:id]).to_a[0]
|
120
126
|
end
|
121
127
|
|
128
|
+
def asset_with_access_level
|
129
|
+
scope = model_class_scope.where(uuid: params[:id])
|
130
|
+
if defined?(current_user)
|
131
|
+
scope.pluck(:asset, :level)
|
132
|
+
else
|
133
|
+
scope.pluck(:asset, '"read"')
|
134
|
+
end.to_a[0]
|
135
|
+
end
|
136
|
+
|
122
137
|
def model_class_scope(var = :asset)
|
123
138
|
@model_class_scope ||= if defined?(current_user)
|
124
139
|
model_class.authorized_for(current_user)
|
@@ -1,15 +1,3 @@
|
|
1
1
|
- if asset.body.present?
|
2
2
|
= asset.body
|
3
|
-
|
4
|
-
.ui.link.cards
|
5
|
-
- asset.image_array.each do |image|
|
6
|
-
.card
|
7
|
-
.image = image_tag image.source_url, class: 'ui image tiny rounded'
|
8
|
-
.content
|
9
|
-
.header = image.title if image.title.present?
|
10
|
-
- if image.description.present?
|
11
|
-
.meta = image.description
|
12
|
-
.extra.content
|
13
|
-
a.ui.large.green.button href="#{image.source_url}" Full Size
|
14
|
-
|
15
|
-
|
3
|
+
= render partial: 'images', locals: {asset: asset}
|
@@ -1,9 +1,11 @@
|
|
1
|
-
= form_for @asset, url: url_for(action: action), html: {class: 'ui form'} do |f|
|
2
|
-
=
|
3
|
-
/.field
|
4
|
-
/ label Image
|
1
|
+
= form_for @asset, url: url_for(action: action), html: {class: 'ui form', multipart: true} do |f|
|
2
|
+
= render partial: 'images', locals: {asset: @asset}
|
5
3
|
|
6
|
-
|
4
|
+
- if @access_level == 'write'
|
5
|
+
.field
|
6
|
+
label Add image
|
7
|
+
|
8
|
+
= file_field_tag 'image'
|
7
9
|
|
8
10
|
- @asset.class.authorized_properties_and_levels(current_user).each do |property, level|
|
9
11
|
.field
|
@@ -0,0 +1,13 @@
|
|
1
|
+
- if asset.image_array.present?
|
2
|
+
.ui.link.cards
|
3
|
+
- asset.image_array.each do |image|
|
4
|
+
.card
|
5
|
+
.image = image_tag image.source_url, class: 'ui image tiny rounded'
|
6
|
+
.content
|
7
|
+
.header = image.title if image.title.present?
|
8
|
+
- if image.description.present?
|
9
|
+
.meta = image.description
|
10
|
+
.extra.content
|
11
|
+
a.ui.large.green.button href="#{image.source_url}" Full Size
|
12
|
+
|
13
|
+
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: graph_starter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Underwood
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-11-
|
11
|
+
date: 2015-11-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -139,6 +139,7 @@ files:
|
|
139
139
|
- app/views/graph_starter/assets/_cards.html.slim
|
140
140
|
- app/views/graph_starter/assets/_dynamic_items.html.slim
|
141
141
|
- app/views/graph_starter/assets/_form.html.slim
|
142
|
+
- app/views/graph_starter/assets/_images.html.slim
|
142
143
|
- app/views/graph_starter/assets/_property_items.html.slim
|
143
144
|
- app/views/graph_starter/assets/_search.html.slim
|
144
145
|
- app/views/graph_starter/assets/edit.html.slim
|