Skip to content

Commit

Permalink
Merge pull request #50 from banta/main
Browse files Browse the repository at this point in the history
#48 Flag features that will probably not make it to version1
  • Loading branch information
banta authored Mar 13, 2023
2 parents 7ea1c58 + e5d5b96 commit 0f7fc7e
Show file tree
Hide file tree
Showing 8 changed files with 121 additions and 48 deletions.
30 changes: 21 additions & 9 deletions app/views/landing/home/_chapters.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
<%= image_tag image_path 'country_kenya.png' %>
<div>
<p class="text-2xl text-red-600">Kenya</p>
<p>Join community</p>
<%= link_to new_user_registration_path do %>
<p>Join community</p>
<% end %>
</div>
</div>
</div>
Expand All @@ -22,7 +24,9 @@
<%= image_tag image_path 'country_rwanda.png' %>
<div>
<p class="text-2xl text-red-600">Rwanda</p>
<p>Join community</p>
<%= link_to new_user_registration_path do %>
<p>Join community</p>
<% end %>
</div>
</div>
</div>
Expand All @@ -33,7 +37,10 @@
<%= image_tag image_path 'country_tanzania.png' %>
<div>
<p class="text-2xl text-red-600">Tanzania</p>
<p>Join community</p>

<%= link_to new_user_registration_path do %>
<p>Join community</p>
<% end %>
</div>
</div>
</div>
Expand All @@ -44,19 +51,24 @@
<%= image_tag image_path 'country_uganda.png' %>
<div>
<p class="text-2xl text-red-600">Uganda</p>
<p>Join community</p>

<%= link_to new_user_registration_path do %>
<p>Join community</p>
<% end %>
</div>
</div>
</div>

<div class="carousel-item">
<div class="grid flex-grow w-44 h-40 card place-items-center border border-slate-900
<a href="mailto:[email protected]">
<div class="grid flex-grow w-44 h-40 card place-items-center border border-slate-900
border-dashed rounded-b-md rounded-tr-md">
<%= image_tag image_path 'add.png' %>
<div class="px-5">
<p class="text-2xl">Request new chapter</p>
<%= image_tag image_path 'add.png' %>
<div class="px-5">
<p class="text-2xl">Request new chapter</p>
</div>
</div>
</div>
</a>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/views/landing/home/_previous_sponsors.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
</div>

<div class="flex container justify-center pt-12 pb-12">
<a href="#">
<a href="mailto:[email protected]">
<div class="inline-flex text-sm">
<p class="text-xl">
Become a sponsor
Expand Down
8 changes: 6 additions & 2 deletions app/views/landing/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
<%= render 'landing/home/intro' %>

<%= render 'landing/home/coming_up_events' %>
<% if FeatureFlag.find_by(name: 'events').try(:enabled) %>
<%= render 'landing/home/coming_up_events' %>
<% end %>

<%= render 'landing/home/who_we_are' %>

<%= render 'landing/home/activities' %>

<%= render 'landing/home/projects' %>
<% if FeatureFlag.find_by(name: 'projects').try(:enabled) %>
<%= render 'landing/home/projects' %>
<% end %>

<%= render 'landing/home/chapters' %>

Expand Down
62 changes: 44 additions & 18 deletions app/views/layouts/_footer.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,47 @@
<div class="basis-1/6">
<ul>
<li><%= link_to 'Home', root_path %></li>
<li><%= link_to 'Events', '#' %></li>
<li><%= link_to 'Conferences', '#' %></li>

<% if FeatureFlag.find_by(name: 'events').try(:enabled) %>
<li><%= link_to 'Events', '#' %></li>
<% end %>

<% if FeatureFlag.find_by(name: 'conferences').try(:enabled) %>
<li><%= link_to 'Conferences', '#' %></li>
<% end %>

<li><%= link_to 'Chapters', '#' %></li>
<li><%= link_to 'Projects', '#' %></li>

<% if FeatureFlag.find_by(name: 'projects').try(:enabled) %>
<li><%= link_to 'Projects', '#' %></li>
<% end %>
</ul>
</div>
<div class="basis-1/6">
<ul>
<li>
<%= link_to 'Learning materials', '#' %></li>
<li><%= link_to 'Members', '#' %></li>

<% if FeatureFlag.find_by(name: 'learning_materials').try(:enabled) %>
<li><%= link_to 'Learning materials', '#' %></li>
<% end %>

<% if FeatureFlag.find_by(name: 'members').try(:enabled) %>
<li><%= link_to 'Members', '#' %></li>
<% end %>

<li><%= link_to 'About', landing_about_path %></li>
<li><%= link_to 'Contact Us', '#' %></li>
<li><%= link_to 'Code of conduct', '#' %></li>

<% if FeatureFlag.find_by(name: 'contact_us').try(:enabled) %>
<li><%= link_to 'Contact Us', '#' %></li>
<% end %>

<% if FeatureFlag.find_by(name: 'contact_us').try(:enabled) %>
<li><%= link_to 'Code of conduct', '#' %></li>
<% end %>
</ul>
</div>
<div class="basis-1/6">
<ul>
<li><%= link_to 'Sponsor', '#' %></li>
<li><%= link_to 'Sponsor', 'mailto:[email protected]' %></li>
</ul>
</div>
<div class="basis-1/6">
Expand All @@ -42,16 +64,20 @@
</div>
<% end %>
</li>
<li>
<%= link_to '#' do %>
<div class="inline-flex text-sm">
<div class="pr-4 self-center">
<%= image_tag image_path('brands_telegram.png'), class: "w-5" %>

<% if FeatureFlag.find_by(name: 'telegram').try(:enabled) %>
<li>
<%= link_to '#' do %>
<div class="inline-flex text-sm">
<div class="pr-4 self-center">
<%= image_tag image_path('brands_telegram.png'), class: "w-5" %>
</div>
Telegram
</div>
Telegram
</div>
<% end %>
</li>
<% end %>
</li>
<% end %>

<li>
<li>
<%= link_to '#' do %>
Expand Down
54 changes: 40 additions & 14 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,24 @@
bg-base-100 rounded-box w-52 md:hidden">
<li><%= link_to 'Home', root_path %></li>
<li><%= link_to 'About', landing_about_path %></li>
<li><a href="#">Events</a></li>
<li><a href="#">Conferences</a></li>

<% if FeatureFlag.find_by(name: 'events').try(:enabled) %>
<li><a href="#">Events</a></li>
<% end %>

<% if FeatureFlag.find_by(name: 'conferences').try(:enabled) %>
<li><a href="#">Conferences</a></li>
<% end %>

<li><%= link_to 'Chapters', chapters_path %></li>
<li><a href="#">Projects</a></li>
<li><a href="#">Learning Materials</a></li>

<% if FeatureFlag.find_by(name: 'projects').try(:enabled) %>
<li><a href="#">Projects</a></li>
<% end %>

<% if FeatureFlag.find_by(name: 'learning_materials').try(:enabled) %>
<li><a href="#">Learning Materials</a></li>
<% end %>

<% if user_signed_in? %>
<li><%= button_to "Sign out", destroy_user_session_path, method: :delete %></li>
Expand All @@ -52,18 +65,31 @@
class: "text-sm font-small text-gray-500 hover:text-red-600" %>
<%= link_to 'About', landing_about_path,
class: "text-sm font-small text-gray-500 hover:text-red-600" %>
<a href="#" class="text-sm font-small text-gray-500 hover:text-red-600">Events</a>
<a href="#" class="text-sm font-small text-gray-500 hover:text-red-600">
Conferences
</a>

<% if FeatureFlag.find_by(name: 'events').try(:enabled) %>
<a href="#" class="text-sm font-small text-gray-500 hover:text-red-600">Events</a>
<% end %>

<% if FeatureFlag.find_by(name: 'conferences').try(:enabled) %>
<a href="#" class="text-sm font-small text-gray-500 hover:text-red-600">
Conferences
</a>
<% end %>

<%= link_to 'Chapters', chapters_path,
class: "text-sm font-small text-gray-500 hover:text-red-600" %>
<a href="#" class="text-sm font-small text-gray-500 hover:text-red-600">
Projects
</a>
<a href="#" class="text-sm font-small text-gray-500 hover:text-red-600">
Learning Materials
</a>

<% if FeatureFlag.find_by(name: 'projects').try(:enabled) %>
<a href="#" class="text-sm font-small text-gray-500 hover:text-red-600">
Projects
</a>
<% end %>

<% if FeatureFlag.find_by(name: 'learning_materials').try(:enabled) %>
<a href="#" class="text-sm font-small text-gray-500 hover:text-red-600">
Learning Materials
</a>
<% end %>
</nav>
<% if user_signed_in? %>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class RenameFeatureToNameForFeatureFlags < ActiveRecord::Migration[7.0]
def change
rename_column :feature_flags, :feature, :name
end
end
4 changes: 2 additions & 2 deletions db/schema.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions test/fixtures/feature_flags.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html

one:
feature: MyString
name: MyString
description: MyText
enabled: false

two:
feature: MyString
name: MyString
description: MyText
enabled: false

0 comments on commit 0f7fc7e

Please sign in to comment.