diff --git a/app/models/users/user.rb b/app/models/users/user.rb index db14d393..12ca3c8b 100644 --- a/app/models/users/user.rb +++ b/app/models/users/user.rb @@ -184,6 +184,10 @@ class User < ApplicationRecord Rails.application.config.content_types[:all].select { |c| can_create? c } end + def words_written_today + word_count_updates.where(created_at: Time.current.beginning_of_day..Time.current.end_of_day).sum(:word_count) + end + # as_json creates a hash structure, which you then pass to ActiveSupport::json.encode to actually encode the object as a JSON string. # This is different from to_json, which converts it straight to an escaped JSON string, # which is undesireable in a case like this, when we want to modify it diff --git a/app/views/main/components/_create_new_page_list.html.erb b/app/views/main/components/_create_new_page_list.html.erb index a66b7dc2..b467d60e 100644 --- a/app/views/main/components/_create_new_page_list.html.erb +++ b/app/views/main/components/_create_new_page_list.html.erb @@ -2,10 +2,10 @@ <% (@activated_content_types + ["Timeline", "Document"]).each do |content_type| %> <% klass = content_class_from_name(content_type) %> <%= link_to send("new_#{content_type.downcase}_path") do %> -
  • -
    - <%= klass.icon %> -
    +
  • +
    + <%= klass.icon %> +
    <%= content_type %>
    @@ -14,13 +14,136 @@ <% end %> <%= link_to customization_content_types_path do %> -
  • -
    - add -
    +
  • +
    + add +
    More...
  • <% end %> + + + + diff --git a/app/views/main/dashboard.html.erb b/app/views/main/dashboard.html.erb index 26b03ae7..0cf14d45 100644 --- a/app/views/main/dashboard.html.erb +++ b/app/views/main/dashboard.html.erb @@ -48,16 +48,16 @@
    <%= link_to new_character_path do %> - <% end %> <% random_enabled_page_type = (current_user.createable_content_types - [Character]).sample %> <%= link_to new_polymorphic_path(random_enabled_page_type) do %> - @@ -111,4 +111,140 @@
    + + + + + + <%= render partial: 'javascripts/content_linking' %>