ilog 0.3.3 → 0.4.0

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.
Files changed (30) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ilog/assets/javascripts/vue-index.js +52 -47
  3. data/lib/ilog/assets/stylesheets/log-style.css +36 -72
  4. data/lib/ilog/config/routes.rb +1 -2
  5. data/lib/ilog/configuration.rb +11 -2
  6. data/lib/ilog/controllers/digital/show.rb +5 -3
  7. data/lib/ilog/controllers/helpers.rb +20 -0
  8. data/lib/ilog/controllers/index/digital.rb +10 -12
  9. data/lib/ilog/controllers/index/index.rb +49 -51
  10. data/lib/ilog/templates/index/digital.html.erb +12 -11
  11. data/lib/ilog/version.rb +1 -1
  12. data/lib/ilog/views/index/digital.rb +1 -1
  13. data/node_modules/.cache/babel-loader/19259fb2549e760886afb3a8c139fd14.json.gz +0 -0
  14. data/node_modules/.cache/babel-loader/69deb5fe9b62ec8af2bd3e842bdc4cdf.json.gz +0 -0
  15. data/node_modules/.cache/babel-loader/6ef363b374decab0bf31b3f82b549c6d.json.gz +0 -0
  16. data/node_modules/.cache/babel-loader/84bc0c4e1e4d804a8e3874ba22824f9f.json.gz +0 -0
  17. data/node_modules/.cache/babel-loader/90642d02b88f6ffccc0bf891448a7fbd.json.gz +0 -0
  18. data/node_modules/.cache/babel-loader/9968f097b331a3cd26346054731db0e9.json.gz +0 -0
  19. data/node_modules/.cache/babel-loader/c867a9b2a4b95df2eba83851d69588f5.json.gz +0 -0
  20. data/node_modules/.cache/babel-loader/d9297d082c712cf8a0b530ec41057f50.json.gz +0 -0
  21. data/src/sass/log/base.scss +10 -7
  22. data/src/sass/log/list.scss +62 -50
  23. data/src/vue/Ilog.vue +4 -4
  24. data/src/vue/components/Item.vue +2 -2
  25. data/src/vue/components/Post.vue +1 -1
  26. data/src/vue/components/PostBody.vue +18 -18
  27. data/src/vue/components/Stuff.vue +1 -1
  28. data/src/vue/elements/Profile.vue +3 -3
  29. data/src/vue/router.js +3 -3
  30. metadata +11 -2
@@ -5,9 +5,8 @@
5
5
  # get '/hello', to: ->(env) { [200, {}, ['Hello from Hanami!']] }
6
6
 
7
7
  get '/:domain/index', to: 'index#index'
8
+ get '/:domain/(:id)/find', to: 'index#index'
8
9
  get '/:domain/(:id)', to: 'index#digital'
9
-
10
10
  get '/:domain/post', to: 'post#show'
11
11
  get '/:domain/index/vue', to: 'index#vue'
12
12
  get '/:domain/modules/tags', to: 'digital#tags'
13
- # get '/:id', to: 'digital#show'
@@ -1,10 +1,19 @@
1
1
  module Ilog
2
2
  class Configuration
3
- attr_accessor :namespaces, :host, :background_image
3
+ attr_accessor :namespaces, :host, :base, :background_image, :profile
4
4
  def initialize
5
5
  @namespaces = {}
6
6
  @host = 'localhost'
7
+ @base = ''
7
8
  @background_image = ''
9
+ @profile = {
10
+ 'avatar' => '',
11
+ 'author' => '',
12
+ 'status' => '',
13
+ 'website' => '',
14
+ 'email' => '',
15
+ 'location' => '',
16
+ }
8
17
  end
9
18
  end
10
- end
19
+ end
@@ -1,15 +1,17 @@
1
+ require ('ilog/controllers/helpers')
2
+
1
3
  module Ilog
2
4
  module Controllers
3
5
  module Digital
4
6
  class Show
5
7
  include Ilog::Action
8
+ include Helpers
6
9
  def call(params)
7
- @database = Ilog.configuration.namespaces[params[:domain]]
8
- self.set_database @database
10
+ set_database params[:domain]
9
11
  req = request.env['HTTP_ACCEPT']
10
12
  if req.include? 'application/json'
11
13
  post = ::Post.find(params[:id])
12
- Post.namespace = params[:domain]
14
+ Post.namespace = get_namespace params[:domain]
13
15
  self.format = :json
14
16
  self.body = post.to_json(:include => ::Post::DIMENSIONS + ::Post::GROUPINGS, :methods => [:content])
15
17
  else
@@ -0,0 +1,20 @@
1
+ module Ilog
2
+ module Controllers
3
+ module Helpers
4
+ def set_database path
5
+ puts 'sbs ' + path
6
+ tmp_config = ActiveRecord::Base.connection_config
7
+ tmp_config[:database] = get_database path
8
+ ActiveRecord::Base.establish_connection tmp_config
9
+ end
10
+ def get_database path
11
+ puts 'dbs ' + path
12
+ puts 'result is = ' + Ilog.configuration.namespaces[get_namespace path]
13
+ Ilog.configuration.namespaces[get_namespace path]
14
+ end
15
+ def get_namespace path
16
+ path
17
+ end
18
+ end
19
+ end
20
+ end
@@ -1,21 +1,19 @@
1
+ require ('ilog/controllers/helpers')
2
+
1
3
  module Ilog
2
4
  module Controllers
3
5
  module Index
4
6
  class Digital
5
7
  include Ilog::Action
6
- expose :namespace, :host
7
- def set_database database
8
- tmp_config = ActiveRecord::Base.connection_config
9
- tmp_config[:database] = database
10
- ActiveRecord::Base.establish_connection tmp_config
11
- end
8
+ include Helpers
9
+ expose :namespace, :vue_config
12
10
  def call(params)
13
- @database = Ilog.configuration.namespaces[params[:domain]]
14
- self.set_database @database
15
- @namespace = params[:domain]
16
- @host = Ilog.configuration.host
11
+ set_database params[:domain]
12
+ @vue_config = Ilog.configuration
13
+ @namespace = get_namespace params[:domain]
17
14
  req = request.env['HTTP_ACCEPT']
18
- if req.include? 'application/json'
15
+
16
+ if req.include? 'application/json'
19
17
  post = ::Post.find(params[:id])
20
18
  post.namespace = @namespace
21
19
  self.format = :json
@@ -25,4 +23,4 @@ module Ilog
25
23
  end
26
24
  end
27
25
  end
28
- end
26
+ end
@@ -3,62 +3,64 @@ module Ilog
3
3
  module Index
4
4
  class Index
5
5
  include Ilog::Action
6
-
6
+ include Ilog::Controllers::Helpers
7
+
7
8
  expose :books, :database
8
-
9
+
9
10
  GN = 7 # Golden Number
10
11
  @count = {}
11
-
12
+
12
13
  @posts
13
14
  @stuffs
14
15
  @timestamps
15
16
  @data
16
-
17
+
17
18
  def perform function, params, input = nil
18
- # @posts = ::Post.send(function, input)
19
- # @stuffs = ::Stuff.send(function, input)
20
- @timestamps = ::Dimensions::Timestamp.where(timestampable_type: 'Post').or(::Dimensions::Timestamp.where(timestampable_type: 'Stuff')).order(publish: :desc)
21
- # @posts = ::Post.includes(['title', 'slug', 'timestamp', 'peoples', 'keywords']).all
22
- # @stuffs = ::Stuff.includes(['title', 'slug', 'timestamp', 'peoples', 'keywords']).all
23
- # puts 'here it is' + @posts.to_s
24
- # @items = @posts + @stuffs
25
- # puts 'here it is' + @posts.to_s
26
- # @items = @items.order('timestamps.publish DESC')
27
-
28
- @items = @timestamps
29
- @items = self.paginate(@items, params)
30
-
19
+ timestamps = ::Dimensions::Timestamp.where(timestampable_type: 'Post').or(::Dimensions::Timestamp.where(timestampable_type: 'Stuff')).order(publish: :desc)
20
+
21
+ data = {}
22
+ puts 'how params is doing? ' + params.get(:id).to_s
23
+ if params.get(:id).nil?
24
+ puts 'wee are getting better'
25
+ items_selected = timestamps.slice( GN * @page.to_i, GN )
26
+ items_selected.each_with_index do |item, index|
27
+ piece = Object.const_get(item.timestampable_type.capitalize).find(item.timestampable_id)
28
+ data[index] = JSON.parse(piece.to_json(:include => ['title', 'slug', 'timestamp', 'peoples', 'keywords'], :methods => [:kind, :uniq]))
29
+ end
30
+ else
31
+ timestamp = ::Dimensions::Timestamp.where(timestampable_type: 'Post', timestampable_id: params[:id]).first
32
+ retrive_index = timestamps.map(&:id).index(timestamp.id)
33
+ @page = (timestamps.map(&:id).index(timestamp.id).to_i / GN).to_i
34
+ items_selected = timestamps.slice( GN * @page.to_i, GN )
35
+ items_selected.each_with_index do |item, index|
36
+ piece = Object.const_get(item.timestampable_type.capitalize).find(item.timestampable_id)
37
+ data[index] = JSON.parse(piece.to_json(:include => ['title', 'slug', 'timestamp', 'peoples', 'keywords'], :methods => [:kind, :uniq]))
38
+ if (item.id == timestamp.id)
39
+ post = Object.const_get(timestamp.timestampable_type.capitalize).find(timestamp.timestampable_id)
40
+ post.namespace = get_namespace params[:domain]
41
+ data[index][:content] = post.content
42
+ data[index][:view] = 'post_body'
43
+ end
44
+ end
45
+ end
31
46
  @count = {
32
47
  'posts' => 0,
33
48
  'stuffs' => 0
34
49
  }
35
-
36
50
  self.format = :json
37
- self.body = {:items => @items, :count => @count}.to_json
51
+ self.body = {:items => paginate(timestamps.count, params, data), :count => @count}.to_json
38
52
  end
39
-
40
- def set_database database
41
- tmp_config = ActiveRecord::Base.connection_config
42
- tmp_config[:database] = database
43
- ActiveRecord::Base.establish_connection tmp_config
44
- end
45
-
53
+
46
54
  def initialize
47
55
  # puts 'here we go' + Ilog.configuration.namespaces.class.to_s
48
-
56
+
49
57
  @posts = ::Post.all
50
58
  # p 'getting posts = ' + @posts.to_s
51
59
  @stuffs = ::Stuff.all
52
60
  end
53
-
54
- def paginate items, params
55
- unless params[:page].nil?
56
- @page = params[:page]
57
- else
58
- @page = 0
59
- end
60
- @items_selected = items.slice( GN * @page.to_i, GN )
61
- @last_page = [(items.count / GN).ceil, 1].max
61
+
62
+ def paginate count, params, data
63
+ @last_page = [(count / GN).ceil, 1].max
62
64
  def next_page_url
63
65
  if ( @last_page > @page.to_i)
64
66
  return '/index?page=' + (@page.to_i + 1).to_s
@@ -71,17 +73,10 @@ module Ilog
71
73
  return nil
72
74
  end
73
75
  end
74
-
75
- @data = {}
76
- @items_selected.each_with_index do |item, index|
77
- puts 'the index is equal to ' + index.to_s
78
- piece = Object.const_get(item.timestampable_type.capitalize).find(item.timestampable_id)
79
- @data[index] = JSON.parse(piece.to_json(:include => ['title', 'slug', 'timestamp', 'peoples', 'keywords'], :methods => [:kind, :uniq]))
80
- end
81
-
76
+
82
77
  return {
83
78
  'current_page' => @page,
84
- 'data' => @data,
79
+ 'data' => data,
85
80
  'first_page_url' => '', # $this->url(1),
86
81
  'from' => '', # $this->firstItem(),
87
82
  'last_page' => @last_page, #$this->lastPage(),
@@ -91,17 +86,20 @@ module Ilog
91
86
  'per_page' => GN, #$this->perPage(),
92
87
  'prev_page_url' => prev_page_url, #$this->previousPageUrl(),
93
88
  'to' => '', #$this->lastItem(),
94
- 'total' => items.count,
89
+ 'total' => count,
95
90
  }
96
91
  end
97
-
98
-
92
+
99
93
  def call(params)
100
- @database = Ilog.configuration.namespaces[params[:domain]]
101
- self.set_database @database
94
+ unless params[:page].nil?
95
+ @page = params[:page]
96
+ else
97
+ @page = 0
98
+ end
99
+ set_database params[:domain]
102
100
  self.perform(:retrive_all, params)
103
101
  end
104
102
  end
105
103
  end
106
104
  end
107
- end
105
+ end
@@ -10,9 +10,10 @@
10
10
  <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.2/css/all.css" integrity="sha384-fnmOCqbTlWIlj8LyTjo7mOUStjsKC4pOpQbqyi7RrhN7udi9RwhKkMHpvLbHG9Sr" crossorigin="anonymous">
11
11
  <script>
12
12
  Window.Config = {
13
- "host": "<%= host %>",
13
+ "host": "<%= vue_config.host %>",
14
+ "base": "<%= vue_config.base %>",
14
15
  "title": "My Blog",
15
- "profile": { "avatar": "", "author": "", "status": "", "website": "", "email": "", "location": "" },
16
+ "profile": <%= vue_config.profile.to_json %>,
16
17
  "digital": { "uri": "<%= namespace %>" },
17
18
  "analog": { "uri": "weblog" }
18
19
  };
@@ -27,25 +28,25 @@
27
28
  -o-background-size: cover;
28
29
  background-size: cover;
29
30
  }
30
- </style>
31
+ </style>
31
32
  </head>
32
-
33
+
33
34
  <body>
34
- <noscript>
35
- <!--
35
+ <noscript>
36
+ <!--
36
37
  <header>
37
38
  <h1>
38
39
  <a href="{{ url(config('bp-log.digital.uri'), '') }}">{{ config('bp-log.title')}}</a>
39
40
  <span><a class="inlink" style="font-size: .8rem;" href="{{ url(config('bp-log.analog.uri'), '') }}">static version</a></span>
40
41
  </h1>
41
42
  </header>
42
- -->
43
+ -->
43
44
  </noscript>
44
-
45
-
46
-
45
+
46
+
47
+
47
48
  <div id="bp-log">
48
49
  </div>
49
50
  <%= javascript 'vue-index' %>
50
51
  </body>
51
- </html>
52
+ </html>
data/lib/ilog/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Ilog
2
- VERSION = "0.3.3"
2
+ VERSION = "0.4.0"
3
3
  end
@@ -5,7 +5,7 @@ module Ilog
5
5
  include Ilog::View
6
6
  layout false
7
7
  def host
8
- raw locals[:host]
8
+ raw locals[:vue_config]
9
9
  end
10
10
  end
11
11
  end
@@ -2,7 +2,7 @@
2
2
  color: black;
3
3
  text-shadow: none;
4
4
  overflow: visible;
5
-
5
+
6
6
  > header, > footer {
7
7
  z-index: 2;
8
8
  text-shadow: none;
@@ -36,8 +36,8 @@
36
36
  border-radius: 0px .4rem .4rem 0px;
37
37
  }
38
38
  }
39
-
40
-
39
+
40
+
41
41
  > header {
42
42
  > p {
43
43
  margin: 0px .4rem;
@@ -63,6 +63,7 @@
63
63
  }
64
64
  }
65
65
  .avatar {
66
+ margin: 1rem;
66
67
  padding: 0px;
67
68
  display: inline-block;
68
69
  background-position: center;
@@ -70,6 +71,8 @@
70
71
  background-size: cover;
71
72
  min-width: 2rem;
72
73
  min-height: 2rem;
74
+ width: auto;
75
+ height: auto;
73
76
  max-height: 30vh;
74
77
  max-width: 100%;
75
78
  @include breakpoint(lg) {
@@ -82,7 +85,7 @@
82
85
  }
83
86
  }
84
87
  }
85
-
88
+
86
89
  }
87
90
  > footer {
88
91
  margin: 0px;
@@ -120,13 +123,13 @@
120
123
  @include breakpoint(xl) {
121
124
  display: block;
122
125
  padding: .8rem !important;
123
-
126
+
124
127
  > span {
125
128
  display: inline;
126
129
  }
127
130
  }
128
131
  }
129
-
132
+
130
133
  }
131
134
  }
132
- }
135
+ }
@@ -13,9 +13,12 @@
13
13
  background-color: $main-color !important;
14
14
  }
15
15
  img {
16
+ margin: 1rem;
16
17
  max-width: 45vw;
17
18
  max-height: 50vh;
18
19
  padding: 0px;
20
+ min-width: 4rem;
21
+ min-height: 4rem;
19
22
  }
20
23
  }
21
24
  > .tunekit {
@@ -65,8 +68,9 @@
65
68
  > header, > footer {
66
69
  nav {
67
70
  text-align: center;
68
- background-color: rgba($second-color, .9);
71
+ background-color: rgba($main-color, .9);
69
72
  .button {
73
+ font-size: 1.2rem;
70
74
  display: block;
71
75
  cursor: hand;
72
76
  color: $second-color-op;
@@ -74,6 +78,11 @@
74
78
  background-color: #333;
75
79
  color: white;
76
80
  }
81
+ .loading::after {
82
+ border-color: $second-color-op;
83
+ border-right-color: transparent;
84
+ border-top-color: transparent;
85
+ }
77
86
  }
78
87
  }
79
88
  }
@@ -103,7 +112,7 @@
103
112
  color: $main-color;
104
113
  }
105
114
  .title {
106
- padding: 0px 1em .9em 1em;
115
+ padding: 0px 1em .4em 1em;
107
116
  display: block;
108
117
  }
109
118
 
@@ -114,7 +123,9 @@
114
123
  max-height: 75vh;
115
124
  }
116
125
  .tag {
117
- display: content;
126
+ display: inline-block !important;
127
+ margin: 0px;
128
+ padding: 0px;
118
129
  > a {
119
130
  font-size: .8rem;
120
131
  margin: 0px .5rem;
@@ -138,7 +149,12 @@
138
149
  }
139
150
  }
140
151
  > footer {
141
- background-color: lighten($second-color, 20%);
152
+ padding: .4rem 1.4rem;
153
+ text-align: center;
154
+ color: lighten($second-color, 10%);
155
+ }
156
+ > footer.container {
157
+ padding: 0px;
142
158
  }
143
159
  background-color: #fff;
144
160
  opacity: .9;
@@ -146,7 +162,7 @@
146
162
  }
147
163
  > .active { opacity: 1; }
148
164
  }
149
- > .Stuff {
165
+ > .stuff {
150
166
  > * {
151
167
  background-color: $second-color;
152
168
  }
@@ -166,13 +182,6 @@
166
182
  }
167
183
  .log-list {
168
184
  > .post {
169
- animation: colorup .5s forwards;
170
- background-color: rgba($main-color, .9);
171
- color: white;
172
- &:hover {
173
- animation: fade .5s forwards;
174
- background-color: rgba($main-color, 1);
175
- }
176
185
  .post-body {
177
186
  background-color: white;
178
187
  color: black;
@@ -181,19 +190,22 @@
181
190
  padding: 0px;
182
191
  width: 100%;
183
192
  }
193
+ > .text {
194
+ padding-top: 1em !important;
195
+ }
184
196
  .timestamps {
185
197
  margin: 0px;
186
- padding: 0px;
198
+ padding: 1rem;
187
199
  font-size: .8rem;
188
200
  color: white;
189
201
  list-style: none !important;
190
202
  p {
191
- margin: .2rem;
203
+ // margin: .2rem;
192
204
  padding: 0px .4rem;
193
- border-radius: .2rem;
194
- background-color: $second-color;
205
+ // border-radius: .2rem;
206
+ // background-color: $second-color;
195
207
  display: inline-block;
196
- color: $second-color-op;
208
+ color: $second-color;
197
209
  .label {
198
210
  color: #333;
199
211
  }
@@ -201,39 +213,39 @@
201
213
  }
202
214
  }
203
215
  }
204
- > .stuff {
205
- padding: 0px;
206
-
207
- > a {
208
- margin: 0px;
209
- padding: 0px;
210
- display: flex;
211
- > header, > footer {
212
- writing-mode: vertical-lr;
213
- color: $second-color-op;
214
- > * {
215
- padding: 1rem 0px;
216
- margin: auto;
217
- width: fit-content;
218
- height: fit-content;
219
- }
220
- }
221
- background-color: rgba($second-color, .9);
222
- color: #eee;
223
- > header, > footer {
224
- background-color: rgba($second-color, .4);
225
- }
226
- &:hover {
227
- animation: stuffup2 .5s forwards;
228
- background-color: rgba($second-color, 1);
229
- color: black;
230
- > header, > footer {
231
- animation: stuffup .5s forwards;
232
- }
233
- }
234
-
235
- }
236
- }
216
+ // > .stuff {
217
+ // padding: 0px;
218
+ //
219
+ // > a {
220
+ // margin: 0px;
221
+ // padding: 0px;
222
+ // display: flex;
223
+ // > header, > footer {
224
+ // writing-mode: vertical-lr;
225
+ // color: $second-color-op;
226
+ // > * {
227
+ // padding: 1rem 0px;
228
+ // margin: auto;
229
+ // width: fit-content;
230
+ // height: fit-content;
231
+ // }
232
+ // }
233
+ // background-color: rgba($second-color, .9);
234
+ // color: #eee;
235
+ // > header, > footer {
236
+ // background-color: rgba($second-color, .4);
237
+ // }
238
+ // &:hover {
239
+ // animation: stuffup2 .5s forwards;
240
+ // background-color: rgba($second-color, 1);
241
+ // color: black;
242
+ // > header, > footer {
243
+ // animation: stuffup .5s forwards;
244
+ // }
245
+ // }
246
+ //
247
+ // }
248
+ // }
237
249
  }
238
250
  @keyframes stuffup2 {
239
251
  from {color:#eee;
data/src/vue/Ilog.vue CHANGED
@@ -15,7 +15,7 @@
15
15
  <span v-if="title" v-html="title" class="title"></span>
16
16
  <nav v-if="page.prev" class>
17
17
  <span class="status" v-if="loading">{{ loading }}</span>
18
- <span class="button" v-if="!loading" v-on:click="retriveNewer()">Newer</span>
18
+ <span class="button" v-if="!loading" v-on:click="retriveNewer()"><i class="icon icon-more-horiz"></i></span>
19
19
  </nav>
20
20
  </header>
21
21
 
@@ -27,8 +27,8 @@
27
27
 
28
28
  <footer>
29
29
  <nav v-if="page.next" class="footer">
30
- <span class="button" v-if="!loading" v-on:click="retriveNextPage()">Older</span>
31
- <span class="status" v-if="loading">{{ loading }}</span>
30
+ <span class="button" v-if="!loading" v-on:click="retriveNextPage()"><i class="icon icon-more-horiz"></i></span>
31
+ <span class="status button" v-if="loading"><div class="loading loading-lg"></div></span>
32
32
  </nav>
33
33
  </footer>
34
34
  </main>
@@ -110,7 +110,7 @@ export default {
110
110
  return {
111
111
  title: this.head + ' by ' + this.author + ' (Digital Ilog)',
112
112
  meta: [{ vmid: 'description', name: 'description', content: app.profile.status }],
113
- host: Window.Config.host + '/' + app.host
113
+ host: app.host
114
114
  }
115
115
  },
116
116
  mounted () {
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div :class="'item ' + content.kind">
2
+ <div :class="'item ' + content.kind.toLowerCase()">
3
3
  <component :is="content.kind" :content="content">
4
4
  </component>
5
5
  </div>
@@ -43,4 +43,4 @@ export default {
43
43
  </script>
44
44
 
45
45
  <style scoped>
46
- </style>
46
+ </style>
@@ -13,7 +13,7 @@
13
13
  </div>
14
14
  <footer>
15
15
  <template v-if="typeof(content.keywords) !== 'undefined' && content.keywords.length != 0">
16
- <div class="tags" >
16
+ <div class="tags">
17
17
  <template v-for="keyword in content.keywords">
18
18
  <span class="tag">
19
19
  <!--<router-link :to="{ name: 'tag', params: { id: keyword.id }}">-->