diff --git a/app/views/documents/index.html.erb b/app/views/documents/index.html.erb index 488c50e8..70f63796 100644 --- a/app/views/documents/index.html.erb +++ b/app/views/documents/index.html.erb @@ -1,60 +1,79 @@ -
-
-

-
- <%= link_to edit_document_path(:new), class: 'btn green white-text waves-effect waves-light', style: 'height: 45px' do %> - add New Document - <% end %> -
- Your <%= current_user.documents.count %> documents -

-
-
-
- <% @documents.each.with_index do |document, i| %> - <% if i % 3 == 0 %> -
- <% end %> -
-
-
- <%= image_tag "card-headers/document-mini.jpg", class: 'activator' %> -
-
- - <%= document.title.presence || 'Untitled document' %> - -

- <%= pluralize (document.body || "").split(/\s+/).count, 'word' %> -
- updated <%= time_ago_in_words document.updated_at %> ago -

-
-
- <%= link_to edit_document_path(document), class: 'green-text' do %> - <%= Document.icon %> Edit - <% end %> - <% if document.persisted? && current_user.can_delete?(document) %> - <%= link_to document, - method: :delete, - data: { confirm: "Are you sure? This will permanently delete this entire document!" } do %> -
- delete - Delete -
- <% end %> +<% if @documents.any? %> +
+
+

+
+ <%= link_to edit_document_path(:new), class: 'btn green white-text waves-effect waves-light', style: 'height: 45px' do %> + add New Document <% end %>
-
- - <%= document.title.presence || 'Document preview' %> - close - -

- <%= sanitize truncate(document.body, escape: false, length: 420) %> -

-
-

+ Your <%= current_user.documents.count %> documents +
- <% end %> -
+
+
+ <% @documents.each.with_index do |document, i| %> + <% if i % 3 == 0 %> +
+ <% end %> +
+
+
+ <%= image_tag "card-headers/document-mini.jpg", class: 'activator' %> +
+
+ + <%= document.title.presence || 'Untitled document' %> + +

+ <%= pluralize (document.body || "").split(/\s+/).count, 'word' %> +
+ updated <%= time_ago_in_words document.updated_at %> ago +

+
+
+ <%= link_to edit_document_path(document), class: 'green-text' do %> + <%= Document.icon %> Edit + <% end %> + <% if document.persisted? && current_user.can_delete?(document) %> + <%= link_to document, + method: :delete, + data: { confirm: "Are you sure? This will permanently delete this entire document!" } do %> +
+ delete + Delete +
+ <% end %> + <% end %> +
+
+ + <%= document.title.presence || 'Document preview' %> + close + +

+ <%= sanitize truncate(document.body, escape: false, length: 420) %> +

+
+
+
+ <% end %> +
+<% end %> + +<% if @documents.empty? %> +
+

You haven't created any documents yet!

+

+ + <%= Document.icon %> + +

+

+ You can create an unlimited number of documents with no limits on length. Enjoy! +

+ + <%= link_to "Create your first document", edit_document_path(:new), class: "btn #{Document.color}" %> + +
+<% end %> diff --git a/db/schema.rb b/db/schema.rb index 3627d915..579ca8c0 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,6 +11,7 @@ # It's strongly recommended that you check this file into your version control system. ActiveRecord::Schema.define(version: 2018_11_01_234459) do + create_table "api_keys", force: :cascade do |t| t.integer "user_id" t.string "key"