diff --git a/statuses/edit.html.erb b/statuses/edit.html.erb new file mode 100644 index 0000000..e6f7b88 --- /dev/null +++ b/statuses/edit.html.erb @@ -0,0 +1,42 @@ +

Edit Status

+ +<% use_tinymce %> + +<%= form_with(model: [current_user, @status]) do |f| %> +
+ <%= f.label :icon %>
+ <%= f.file_field :icon %> +
+ +
+ <%= f.label :text, "Status Text" %>
+ <%= f.text_area :text, class: "mce-editor observe_textlength", id: "status" %> + + <%= live_validation_for_field( + 'content', + maximum_length: ArchiveConfig.STATUS_MAX, + minimum_length: ArchiveConfig.CONTENT_MIN, + tooLongMessage: ts("Too long lmao"), + tooShortMessage: ts("Too short lmao"), + failureMessage: ts("You need to post some content here.") + ) + %> + + <%= generate_countdown_html("status", 3000) %> +
+ +
+ <%= f.label :mood %>
+ <%= f.text_field :mood %> +
+ +
+ <%= f.label :music %>
+ <%= f.text_field :music %> +
+ +
+ <%= f.submit "Save Status" %> +
+<% end %> + diff --git a/statuses/index.html.erb b/statuses/index.html.erb new file mode 100644 index 0000000..a6bb9d0 --- /dev/null +++ b/statuses/index.html.erb @@ -0,0 +1,34 @@ +

<%= @user&.login || @user&.id || "Statuses" %>

+All Statuses +
+ +
+ <% if @statuses.present? %> + <% @statuses.each do |status| %> + <% if status.icon.attached? %> + <%= image_tag status.icon %> + <% end %> + + <%= time_ago_in_words(status.created_at) %> | + <% if current_user %> + <%= link_to 'Edit', edit_user_status_path(status.user, status) %> | + <%= link_to t("Delete"), user_status_path(status.user, status), + data: { confirm: t("Are you sure? All information in this status will be lost.") }, + method: :delete %> + <% end %> + +

<%= raw sanitize_field(status, :text) %>

+ + <% if status.mood.present? %> +

Mood: <%= status.mood %>

+ <% end %> + + <% if status.music.present? %> +

Music: <%= status.music %>

+ <% end %> + +
+ <% end %> + <% end %> +
+ diff --git a/statuses/new.html.erb b/statuses/new.html.erb new file mode 100644 index 0000000..fbfcd76 --- /dev/null +++ b/statuses/new.html.erb @@ -0,0 +1,41 @@ +

New Status

+ +<% use_tinymce %> +<%= form_with(model: [current_user, @status]) do |f| %> + + <%= f.label :icon %>
+ <%= f.file_field :icon %> + + +
+ <%= f.label :text, "Status Text" %>
+ <%= f.text_area :text, class: "mce-editor observe_textlength", id: "status" %> + + <%= live_validation_for_field( + 'status', + maximum_length: ArchiveConfig.STATUS_MAX, + minimum_length: ArchiveConfig.CONTENT_MIN, + tooLongMessage: ts("Too long lmao"), + tooShortMessage: ts("Too short lmao"), + failureMessage: ts("You need to post some content here.") + ) + %> + + <%= generate_countdown_html("status", ArchiveConfig.STATUS_MAX) %> +
+ +
+ <%= f.label :mood %>
+ <%= f.text_field :mood %> +
+ +
+ <%= f.label :music %>
+ <%= f.text_field :music %> +
+ +
+ <%= f.submit "Save Status" %> +
+<% end %> + diff --git a/statuses/show.html.erb b/statuses/show.html.erb new file mode 100644 index 0000000..ccc4a9b --- /dev/null +++ b/statuses/show.html.erb @@ -0,0 +1,23 @@ +
+

Status

+ + <% if @status.icon.attached? %> + <%= image_tag @status.icon %> + <% end %> + + <%= time_ago_in_words(@status.created_at) %> | + <% if current_user == @status.user %> + <%= link_to 'Edit', edit_user_status_path(@status.user, @status) %> | + <%= link_to t("Delete"), user_status_path(@status.user, @status), + data: { confirm: t("Are you sure? All information in this status will be lost.") }, + method: :delete %> + <% end %> +

<%= raw sanitize_field(@status, :text) %>

+ <% if @status.mood.present? %> +

Mood: <%= @status.mood %>

+ <% end %> + + <% if @status.music.present? %> +

Music: <%= @status.music %>

+
<% end %> +
diff --git a/statuses/statuses_helper.rb b/statuses/statuses_helper.rb new file mode 100644 index 0000000..62fedd9 --- /dev/null +++ b/statuses/statuses_helper.rb @@ -0,0 +1,2 @@ +module StatusesHelper +end