jektify 1.0.7 → 1.0.8

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.
@@ -1,85 +1,59 @@
1
1
  module Jektify
2
-
3
2
  class Render
4
-
5
- $DATETIME = Time.new
6
-
7
- def rendering(app_name, app_root_config, spotify_embed_category, spotify_embed_url, spotify_embed_theme)
8
-
9
- # Checks the state of the description" property in the file "_config.yml"
10
- # jektify__description = app_root_config["title"]["enable"] == false and app_root_config["description"]["enable"] == false ? jektify__description = "none" : jektify__description = "block"
11
-
12
- # Checks the state of the "title => enable" property in the file "_config.yml"
13
- jektify__title = app_root_config["title"]["enable"] == true ? jektify__title = "block" : jektify__title = "none"
14
-
15
- # Checks the state of the "title => enable" property in the file "_config.yml"
16
- jektify__description = app_root_config["description"]["enable"] == true ? jektify__description = "block" : jektify__description = "none"
17
-
18
- # Sets the size of the box where the tracks will stay.
19
- spotify_embed_category == "album" || spotify_embed_category == "playlist" || spotify_embed_category == "artist" ? box_height = 380 : box_height = 80
20
-
21
- # Sets whether the Jektify box will start open or closed
22
- open_track = app_root_config["open"] == true ? open_track = "block" : open_track = "none"
23
-
24
- # If the option to open the box at startup is enabled, the toggle button will also undergo open and close actions.
25
- jektify__button_action = app_root_config["open"] == true ? jektify__button_action = "jektify__button--open" : jektify__button_action = "jektify__button--closed"
26
-
27
- # Checks whether the user will use the Toggle feature or not.
28
- # If do not use it, JavaScript will not be generated for the user. Because it is he who does the Toggle feature.
29
- # The block generating Javascript is in the "Generator" class in the "generate" method. Version 3.0.1
30
- # NOTe: If the user uses the previous version of the "_config.yml" file, there will be no conflict.
31
- jektify__toggle_button = "<span class=\"jektify__button jektify__button--#{spotify_embed_theme} jektify__button--custom #{jektify__button_action}\">+</span>" if app_root_config["toggle"].nil? || app_root_config["toggle"]["enable"] == true
32
-
33
- open_track = "block" if !app_root_config["toggle"].nil? && app_root_config["toggle"]["enable"] == false
34
- jektify__toggle_button = "" if !app_root_config["toggle"].nil? && app_root_config["toggle"]["enable"] == false
35
-
36
- # This is a feature for adding a Spotify user link. Version 3.0.1
37
- # NOTe: If the user uses the previous version of the "_config.yml" file, there will be no conflict.
38
- if app_root_config["spotify"].nil?
39
- jektify__spotify_user = ""
40
- else
41
- jektify__spotify_user = "<div class=\"jektify__user\"><a href=\"https://open.spotify.com/user/#{app_root_config["spotify"]["user"]}\" target=\"_blank\" class=\"jektify__user-link jektify__user-link--#{spotify_embed_theme} jektify__user-link--custom\" title=\"#{app_root_config["spotify"]["text"]}\"><span class=\"jektify__user-text jektify__user-text--#{spotify_embed_theme} jektify__user-text--custom\">#{app_root_config["spotify"]["text"]}</span></a></div>" if !app_root_config["spotify"]["user"].nil? && !app_root_config["spotify"]["text"].nil?
3
+ $DATETIME = Time.now
4
+
5
+ def rendering(app_name, app_root_config, category, url, theme)
6
+ jektify_title = app_root_config.dig("title", "enable") ? "block" : "none"
7
+ jektify_description = app_root_config.dig("description", "enable") ? "block" : "none"
8
+ box_height = %w[album playlist artist].include?(category) ? 380 : 80
9
+ open_track = app_root_config["open"] ? "block" : "none"
10
+ button_action = app_root_config["open"] ? "jektify__button--open" : "jektify__button--closed"
11
+
12
+ toggle_button = if app_root_config.dig("toggle", "enable").nil? || app_root_config.dig("toggle", "enable")
13
+ "<span class=\"jektify__button jektify__button--#{theme} jektify__button--custom #{button_action}\">+</span>"
14
+ else
15
+ ""
16
+ end
17
+
18
+ open_track = "block" if app_root_config.dig("toggle", "enable") == false
19
+
20
+ spotify_user_html = ""
21
+ if app_root_config["spotify"]
22
+ user = app_root_config["spotify"]["user"]
23
+ text = app_root_config["spotify"]["text"]
24
+ if user && text
25
+ spotify_user_html = <<~HTML
26
+ <div class="jektify__user">
27
+ <a href="https://open.spotify.com/user/#{user}" target="_blank" class="jektify__user-link jektify__user-link--#{theme} jektify__user-link--custom" title="#{text}">
28
+ <span class="jektify__user-text jektify__user-text--#{theme} jektify__user-text--custom">#{text}</span>
29
+ </a>
30
+ </div>
31
+ HTML
32
+ end
42
33
  end
43
34
 
44
-
45
- # Render template if enable == true
46
- if app_root_config["enable"] == true
47
- %(<dl class="jektify jektify--#{spotify_embed_theme} jektify--custom">
48
-
49
- <dt class="jektify__header jektify__header--#{spotify_embed_theme} jektify__header--custom">
50
-
51
- <a class="jektify__brand jektify__brand--#{spotify_embed_theme} jektify__brand--custom" href="https://#{app_name}.github.io" target="_blank">#{app_name}</a>
35
+ return unless app_root_config["enable"]
52
36
 
53
- <i class="jektify__year jektify__year--#{spotify_embed_theme} jektify__year--custom">&copy;&nbsp;#{$DATETIME.strftime("%Y")}&nbsp;</i>
54
- #{jektify__toggle_button}
37
+ <<~HTML
38
+ <dl class="jektify jektify--#{theme} jektify--custom">
39
+ <dt class="jektify__header jektify__header--#{theme} jektify__header--custom">
40
+ <a class="jektify__brand jektify__brand--#{theme} jektify__brand--custom" href="https://#{app_name}.github.io" target="_blank">#{app_name}</a>
41
+ <i class="jektify__year jektify__year--#{theme} jektify__year--custom">&copy;&nbsp;#{$DATETIME.year}&nbsp;</i>
42
+ #{toggle_button}
55
43
  </dt>
56
-
57
- <dd class="jektify__body jektify__body--#{spotify_embed_theme} jektify__body--custom" style="display: #{open_track}">
58
-
59
- #{jektify__spotify_user}
60
-
61
- <h1 class="jektify__title jektify__title--#{spotify_embed_theme} jektify__user--#{spotify_embed_theme} jektify__title--custom" style="display: #{jektify__title};">#{app_root_config["title"]["text"]}</h1>
62
-
63
- <p class="jektify__description jektify__description--#{spotify_embed_theme} jektify__description--custom" style="display: #{jektify__description};">#{app_root_config["description"]["text"]}</p>
64
-
65
- <div class="jektify__tracklist jektify__tracklist--#{spotify_embed_theme} jektify__tracklist--custom">
66
- <iframe id="jektify__track"
67
- class="jektify__track jektify__track--#{spotify_embed_theme}
68
- jektify__track--custom"
69
- src="#{spotify_embed_url}"
70
- width="100%"
71
- height="#{box_height}"
72
- frameborder="0"
73
- allowtransparency="true"
74
- allow="encrypted-media">
44
+ <dd class="jektify__body jektify__body--#{theme} jektify__body--custom" style="display: #{open_track}">
45
+ #{spotify_user_html}
46
+ <h1 class="jektify__title jektify__title--#{theme} jektify__title--custom" style="display: #{jektify_title};">#{app_root_config.dig("title", "text")}</h1>
47
+ <p class="jektify__description jektify__description--#{theme} jektify__description--custom" style="display: #{jektify_description};">#{app_root_config.dig("description", "text")}</p>
48
+ <div class="jektify__tracklist jektify__tracklist--#{theme} jektify__tracklist--custom">
49
+ <iframe id="jektify__track" class="jektify__track jektify__track--#{theme} jektify__track--custom"
50
+ src="#{url}" width="100%" height="#{box_height}" frameborder="0"
51
+ allowtransparency="true" allow="encrypted-media">
75
52
  </iframe>
76
53
  </div>
77
54
  </dd>
78
- </dl>)
79
- end
80
-
81
- end # def content
82
-
83
- end # class Render
84
-
85
- end # module Jektify
55
+ </dl>
56
+ HTML
57
+ end
58
+ end
59
+ end
@@ -8,7 +8,7 @@ module Jektify
8
8
 
9
9
  MAJOR = 1
10
10
  MINOR = 0
11
- PATCH = 7
11
+ PATCH = 8
12
12
  VERSION = "#{MAJOR}.#{MINOR}.#{PATCH}"
13
13
 
14
14
  end