rails_admin_tree_browser 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +5 -3
- data/app/views/rails_admin/main/_tree_browser.html.erb +1 -0
- data/lib/rails_admin_tree_browser/tree_browser_field.rb +4 -0
- data/vendor/assets/javascripts/rails_admin/components/tree-browser.vue +6 -2
- data/vendor/assets/javascripts/rails_admin/rails_admin_tree_browser.js.erb +8 -10
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5334f640f177440d0fc32299e3edd31f311bda4c
|
4
|
+
data.tar.gz: 63d8024d397b4d17cced58bad22357b70032f105
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f8915cd793ef22c7d3f2dd7fe8e73d67f9d3e834e3de517724d5e963d0e5908c9ecce2e3a24bdaec0ecf1ae6ff45d5632dea1eaa9e02ce8c398c8b5bcf09ae08
|
7
|
+
data.tar.gz: 400abd81494bde65450293d7f0ba87525149b077350e1b6c52a4d52d50166b7006acc330490f99605eeea849ac18fb0d77b74195425c73cf507779ef799d3a7c
|
data/README.md
CHANGED
@@ -7,7 +7,7 @@ A simple gem to work with [rails_admin](https://github.com/sferik/rails_admin) t
|
|
7
7
|
|
8
8
|
|
9
9
|
```ruby
|
10
|
-
gem "
|
10
|
+
gem "rails_admin_tree_browser"
|
11
11
|
```
|
12
12
|
|
13
13
|
Then, add in your rails admin model initializer<br/>
|
@@ -27,9 +27,10 @@ end
|
|
27
27
|
|
28
28
|
## Config
|
29
29
|
|
30
|
-
- `tree_root_url` - The root url from where we show the
|
31
|
-
- `
|
30
|
+
- `tree_root_url` - The root url from where we show the tree
|
31
|
+
- `tree_download_url` - the download url from where we download the element, need to be download_link to true (Optional)
|
32
32
|
- `download_link` - true/false Show icon with link to download (Optional)
|
33
|
+
- `button_label` - Overwrite the label name (Optional)
|
33
34
|
- `node_type_name` - overwrite de node type name, default: node (Optional)
|
34
35
|
- `element_type_name` - overwrite de element type name, default: element (Optional)
|
35
36
|
|
@@ -41,6 +42,7 @@ RailsAdmin.config do |config|
|
|
41
42
|
edit do
|
42
43
|
field :path, :tree_browser do
|
43
44
|
tree_root_url 'https://url_to_api_return_json.com'
|
45
|
+
tree_download_url
|
44
46
|
button_label 'Choose a file please'
|
45
47
|
download_link true
|
46
48
|
node_type_name 'dir'
|
@@ -8,6 +8,7 @@
|
|
8
8
|
remove-button-label="<%= I18n.t('rails_admin_tree_browser.remove_button') %>"
|
9
9
|
list-title-label="<%= I18n.t('rails_admin_tree_browser.list_title') %>"
|
10
10
|
root-node="<%= field.tree_root_url %>"
|
11
|
+
download-url="<%= field.tree_download_url %>"
|
11
12
|
button-label="<%= field.button_label %>"
|
12
13
|
field-value="<%= @object[field.name] %>"
|
13
14
|
field-name="<%= field.input_name %>"
|
@@ -29,7 +29,7 @@
|
|
29
29
|
<a @click="changeNode(element.path)">{{ element.name }}</a>
|
30
30
|
</div>
|
31
31
|
</td>
|
32
|
-
<td class="text-right" v-
|
32
|
+
<td class="text-right" v-if="downloadUrl && downloadLink">
|
33
33
|
<a :href="downloadLinkPath(element)" download v-if="element.type === elementTypeName">
|
34
34
|
<i class="fa fa-cloud-download"></i>
|
35
35
|
</a>
|
@@ -65,6 +65,10 @@
|
|
65
65
|
type: String,
|
66
66
|
required: true
|
67
67
|
},
|
68
|
+
downloadUrl: {
|
69
|
+
type: String,
|
70
|
+
required: false
|
71
|
+
},
|
68
72
|
downloadLink: {
|
69
73
|
type: Boolean,
|
70
74
|
required: false
|
@@ -115,7 +119,7 @@
|
|
115
119
|
},
|
116
120
|
methods: {
|
117
121
|
downloadLinkPath: function(element) {
|
118
|
-
return this.
|
122
|
+
return this.downloadUrl + '/' + element.download_link
|
119
123
|
},
|
120
124
|
nodeClick: function(node) {
|
121
125
|
this.selectedNode = node.path;
|
@@ -9778,7 +9778,7 @@
|
|
9778
9778
|
/* moduleIdentifier (server only) */
|
9779
9779
|
null
|
9780
9780
|
)
|
9781
|
-
Component.options.__file = "/Users/sebastien/Projects/
|
9781
|
+
Component.options.__file = "/Users/sebastien/Projects/rails_admin_tree_browser/vendor/assets/javascripts/rails_admin/components/tree-browser.vue"
|
9782
9782
|
if (Component.esModule && Object.keys(Component.esModule).some(function (key) {return key !== "default" && key.substr(0, 2) !== "__"})) {console.error("named exports are not supported in *.vue files.")}
|
9783
9783
|
if (Component.options.functional) {console.error("[vue-loader] tree-browser.vue: functional components are not supported with templates, they should use render functions.")}
|
9784
9784
|
|
@@ -10310,6 +10310,10 @@
|
|
10310
10310
|
type: String,
|
10311
10311
|
required: true
|
10312
10312
|
},
|
10313
|
+
downloadUrl: {
|
10314
|
+
type: String,
|
10315
|
+
required: false
|
10316
|
+
},
|
10313
10317
|
downloadLink: {
|
10314
10318
|
type: Boolean,
|
10315
10319
|
required: false
|
@@ -10361,7 +10365,7 @@
|
|
10361
10365
|
|
10362
10366
|
methods: {
|
10363
10367
|
downloadLinkPath: function downloadLinkPath(element) {
|
10364
|
-
return this.
|
10368
|
+
return this.downloadUrl + '/' + element.download_link;
|
10365
10369
|
},
|
10366
10370
|
nodeClick: function nodeClick(node) {
|
10367
10371
|
this.selectedNode = node.path;
|
@@ -12254,13 +12258,7 @@
|
|
12254
12258
|
_vm.changeNode(element.path)
|
12255
12259
|
}
|
12256
12260
|
}
|
12257
|
-
}, [_vm._v(_vm._s(element.name))])]) : _vm._e()]), _vm._v(" "), _c('td', {
|
12258
|
-
directives: [{
|
12259
|
-
name: "show",
|
12260
|
-
rawName: "v-show",
|
12261
|
-
value: (_vm.downloadLink),
|
12262
|
-
expression: "downloadLink"
|
12263
|
-
}],
|
12261
|
+
}, [_vm._v(_vm._s(element.name))])]) : _vm._e()]), _vm._v(" "), (_vm.downloadUrl && _vm.downloadLink) ? _c('td', {
|
12264
12262
|
staticClass: "text-right"
|
12265
12263
|
}, [(element.type === _vm.elementTypeName) ? _c('a', {
|
12266
12264
|
attrs: {
|
@@ -12269,7 +12267,7 @@
|
|
12269
12267
|
}
|
12270
12268
|
}, [_c('i', {
|
12271
12269
|
staticClass: "fa fa-cloud-download"
|
12272
|
-
})]) : _vm._e()])])
|
12270
|
+
})]) : _vm._e()]) : _vm._e()])
|
12273
12271
|
}))])]) : _vm._e()])], 1)
|
12274
12272
|
},staticRenderFns: []}
|
12275
12273
|
module.exports.render._withStripped = true
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_admin_tree_browser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Louis-Philippe Dumas
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-12-
|
12
|
+
date: 2017-12-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|