card-mod-date 0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: e3ab4579aae77cf3fdaad5dcd9e37e24f391ce9bf12dade9614d3bbee42fb93a
4
+ data.tar.gz: f24a1cfcb18348c236d496dadcddfe6270cc4cd6b7dc5c5110b4490ef679e592
5
+ SHA512:
6
+ metadata.gz: c01a9c29c606dcee37c3ba88e6c695d1c0044af8e78d31961746fea405bf6d4c8238e0329869b7c67ef8d4bc523bfbae6020d1195cab00a07cef4890ec5dcb2c
7
+ data.tar.gz: a5df3f3f4b5eb39c6e07e662705f75bc67a05cf88f7b0a0a534647349bf8fec269a517216ca8eb85712a3266b81a7235983157dcf35a8d8d316aeb9f73173262
@@ -0,0 +1,29 @@
1
+ # -*- encoding : utf-8 -*-
2
+
3
+ class AddDatepicker < Card::Migration::Core
4
+ HELP_TEXT = <<-TEXT.strip_heredoc
5
+ Configure the date select tool using these available [[https://tempusdominus.github.io/bootstrap-4/Options/|options]]
6
+ TEXT
7
+
8
+ DEFAULT_CONFIG = <<-TEXT.strip_heredoc
9
+ {
10
+ "format": "YY-MM-DD",
11
+ "useCurrent": true,
12
+ "defaultDate": false
13
+ }
14
+ TEXT
15
+
16
+ def up
17
+ ensure_card "Date", codename: "date", type_id: Card::CardtypeID
18
+ ensure_card "script: datepicker",
19
+ codename: "script_datepicker", type_id: Card::JavaScriptID
20
+ ensure_card "style: datepicker",
21
+ codename: "style_datepicker", type_id: Card::ScssID
22
+ ensure_card "script: datepicker config",
23
+ codename: "script_datepicker_config", type_id: Card::CoffeeScriptID
24
+ ensure_card "*datepicker",
25
+ codename: "datepicker", type_id: Card::JsonID,
26
+ content: DEFAULT_CONFIG
27
+ ensure_card %i[datepicker self help], content: HELP_TEXT
28
+ end
29
+ end
@@ -0,0 +1,26 @@
1
+ decko.addEditor(
2
+ '.date-editor',
3
+ ->
4
+ decko.initDatepicker($(this))
5
+ ->
6
+ @val()
7
+ )
8
+
9
+ $.extend decko,
10
+ setDatepickerConfig: (string) ->
11
+ setter = ->
12
+ try
13
+ $.parseJSON string
14
+ catch
15
+ {}
16
+ decko.datepickerConfig = setter()
17
+
18
+ configDatepicker: () ->
19
+ conf = { format: "YY-MM-DD" }
20
+ hard_conf = {}
21
+ user_conf = if decko.datepickerConfig? then decko.datepickerConfig else {}
22
+ $.extend conf, user_conf, hard_conf
23
+ conf
24
+
25
+ initDatepicker: (input) ->
26
+ input.datetimepicker(decko.configDatepicker())
@@ -0,0 +1,12 @@
1
+ // from tempusdominus-bootstrap-4-build.scss
2
+
3
+ .sr-only {
4
+ position: absolute;
5
+ width: 1px;
6
+ height: 1px;
7
+ margin: -1px;
8
+ padding: 0;
9
+ overflow: hidden;
10
+ clip: rect(0,0,0,0);
11
+ border: 0;
12
+ }
@@ -0,0 +1,9 @@
1
+ Self::InputOptions.add_to_basket :options, "calendar"
2
+
3
+ format :html do
4
+ def calendar_input
5
+ text_field :content, class: "date-editor datetimepicker-input",
6
+ "data-toggle": "datetimepicker",
7
+ "data-target": "##{form_prefix}_content.date-editor"
8
+ end
9
+ end
@@ -0,0 +1,6 @@
1
+ def raw_help_text
2
+ <<-TEXT
3
+ Configure the date select tool using these available
4
+ [[https://tempusdominus.github.io/bootstrap-4/Options/|options]]
5
+ TEXT
6
+ end
@@ -0,0 +1,7 @@
1
+ include_set Abstract::VendorCodeFile
2
+ Self::ScriptMods.add_item :script_datepicker
3
+
4
+ def source_files
5
+ %w[moment/min/moment-with-locales.min.js
6
+ tempusdominus/build/js/tempusdominus-bootstrap-4.js]
7
+ end
@@ -0,0 +1,4 @@
1
+ include_set Abstract::CodeFile
2
+
3
+ Self::ScriptEditors.add_item :script_datepicker_config
4
+ All::Head::HtmlFormat.add_to_basket :mod_js_config, [:datepicker, "setDatepickerConfig"]
@@ -0,0 +1,11 @@
1
+ include_set Abstract::CodeFile
2
+ Self::StyleLibraries.add_item :style_datepicker
3
+
4
+ def source_files
5
+ %w[lib/stylesheets/tempusdominus.scss
6
+ vendor/tempusdominus/src/sass/_tempusdominus-bootstrap-4.scss]
7
+ end
8
+
9
+ def source_dir
10
+ ""
11
+ end
@@ -0,0 +1,5 @@
1
+ format :html do
2
+ def input_type
3
+ :calendar
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,56 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: card-mod-date
3
+ version: !ruby/object:Gem::Version
4
+ version: '0.1'
5
+ platform: ruby
6
+ authors:
7
+ - Ethan McCutchen
8
+ - Philipp Kühl
9
+ - Gerry Gleason
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2020-09-19 00:00:00.000000000 Z
14
+ dependencies: []
15
+ description: ''
16
+ email:
17
+ - info@decko.org
18
+ executables: []
19
+ extensions: []
20
+ extra_rdoc_files: []
21
+ files:
22
+ - db/migrate_core_cards/20180509141814_add_datepicker.rb
23
+ - lib/javascript/script_datepicker_config.js.coffee
24
+ - lib/stylesheets/tempusdominus.scss
25
+ - set/all/calendar.rb
26
+ - set/self/datepicker.rb
27
+ - set/self/script_datepicker.rb
28
+ - set/self/script_datepicker_config.rb
29
+ - set/self/style_datepicker.rb
30
+ - set/type/date.rb
31
+ homepage: http://decko.org
32
+ licenses:
33
+ - GPL-2.0
34
+ - GPL-3.0
35
+ metadata:
36
+ card-mod: date
37
+ post_install_message:
38
+ rdoc_options: []
39
+ require_paths:
40
+ - lib
41
+ required_ruby_version: !ruby/object:Gem::Requirement
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: 2.3.0
46
+ required_rubygems_version: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: '0'
51
+ requirements: []
52
+ rubygems_version: 3.0.3
53
+ signing_key:
54
+ specification_version: 4
55
+ summary: Calendar editor
56
+ test_files: []