diff --git a/app/controllers/contributions/other_controller.rb b/app/controllers/contributions/other_controller.rb new file mode 100644 index 0000000..e4bafff --- /dev/null +++ b/app/controllers/contributions/other_controller.rb @@ -0,0 +1,22 @@ +class Contributions::OtherController < ApplicationController + before_action :authenticate_user! + before_action :set_content_editing + + # GET /contributions/other + def index + @content_title = EditableContent.find_or_create_by( + path: "contributions/other", key: "title" + ) + @content_body = EditableContent.find_or_create_by( + path: "contributions/other", key: "body", rich_text: true + ) + @current_section = :contributions + end + + private + + def set_content_editing + return unless params[:edit] && current_user.is_admin? + @edit_content = true + end +end diff --git a/app/controllers/contributions/projects_controller.rb b/app/controllers/contributions/projects_controller.rb deleted file mode 100644 index 7989fef..0000000 --- a/app/controllers/contributions/projects_controller.rb +++ /dev/null @@ -1,8 +0,0 @@ -class Contributions::ProjectsController < ApplicationController - before_action :authenticate_user! - - # GET /contributions - def index - @current_section = :contributions - end -end diff --git a/app/views/contributions/other/index.html.erb b/app/views/contributions/other/index.html.erb new file mode 100644 index 0000000..271eca2 --- /dev/null +++ b/app/views/contributions/other/index.html.erb @@ -0,0 +1,42 @@ +<%= render HeaderComponent.new(title: "Contributions") %> + +<%= render MainWithTabnavComponent.new(tabnav_partial: "shared/tabnav_contributions") do %> + <% if @edit_content %> +
+ <%= form_with model: [:admin, @content_title] do |form| %> +

+ <%= form.label :content, @content_title.key.capitalize, class: 'font-bold' %> +

+

+ <%= form.text_field :content %> + <%# <%= form.submit "Save", class: "btn-md btn-blue" %> + <%= button_tag type: 'submit', name: nil, title: "Save", class: 'btn-md btn-icon btn-outline' do %> + <%= render partial: "icons/save", locals: { custom_class: "text-blue-600 h-4 w-4 inline" } %> + <% end %> +

+ <% end %> +
+
+ <%= form_with model: [:admin, @content_body] do |form| %> +

+ <%= form.label :content, @content_body.key.capitalize, class: 'font-bold' %> +

+

+ <%= form.textarea :content, class: "w-full h-96" %> +

+

+ <%= link_to 'Cancel', request.path, class: 'btn-md btn-gray' %> + <%= form.submit "Save", class: "ml-2 btn-md btn-blue" %> +

+ <% end %> +
+ <% else %> +
+ <% if @content_body.content.present? %> + <%= markdown_to_html @content_body.content %> + <% else %> + No content yet + <% end %> +
+ <% end %> +<% end %> diff --git a/app/views/contributions/projects/index.html.erb b/app/views/contributions/projects/index.html.erb deleted file mode 100644 index 253b860..0000000 --- a/app/views/contributions/projects/index.html.erb +++ /dev/null @@ -1,49 +0,0 @@ -<%= render HeaderComponent.new(title: "Contributions") %> - -<%= render MainWithTabnavComponent.new(tabnav_partial: "shared/tabnav_contributions") do %> -
-

- Project contributions are how we develop and run all Kosmos software and - services. Everything we create and provide is free and open-source - software, even the page you're looking at right now! -

-

Start contributing

-

- Check out our - projects page - for some (but not all) potential places that can use your help. -

-

- There's something to do for everyone, especially non-programmers! For - example, we need more help with graphics, UI/UX design, and - content/copywriting. Also, testing any of our software and reporting - issues you encounter along the way is very valuable. -

-

- A good way to get started is to join one of our - chat rooms - and introduce yourself. Alternatively, you can also ping us on any other - medium, or even just grab an open issue on our - Gitea - or on - GitHub - and dive right in. -

-

- Last but not least, if you want to help by proposing new features or - services, or by giving feedback on existing ones, head over to the - community forums, - where you can do just that. -

-

Open Source Grants

-

- Money coming in from financial contributions is first used to pay for our - bills. Additional funds are being paid out directly to our contributors, - including you, according to their rough share of contributions. -

-

- We have run two 6-month trials so far, with the next trial period - starting sometime soon. Watch your email for notifications about it! -

-
-<% end %> diff --git a/app/views/shared/_tabnav_contributions.html.erb b/app/views/shared/_tabnav_contributions.html.erb index 96db0db..2cc243b 100644 --- a/app/views/shared/_tabnav_contributions.html.erb +++ b/app/views/shared/_tabnav_contributions.html.erb @@ -1,12 +1,14 @@
diff --git a/config/routes.rb b/config/routes.rb index 094bf62..f55f778 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -25,7 +25,7 @@ Rails.application.routes.draw do get 'confirm_btcpay' end end - get 'projects', to: 'projects#index' + get 'other', to: 'other#index' end resources :invitations, only: ['index', 'show', 'create', 'destroy']