Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adds Community to CustomForm entity and uses CustomForm with Community #1764

Draft
wants to merge 5 commits into
base: vibol/community
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
adds community model spec with relation of custom form and some trans…
…lation
  • Loading branch information
PirunSeng committed Dec 26, 2020
commit 2e5873ff24d0c5f6add86dac9774f51279ba20d3
37 changes: 17 additions & 20 deletions app/views/communities/show.html.haml
Original file line number Diff line number Diff line change
@@ -27,27 +27,24 @@

.col-md-3
.col-sm-12
.panel.panel-default.case-management-tool-set
.panel-body.text-center{ style: 'min-height: 50px; background-color: yellow;' }
%h3 Case Management Tool Set
.btn-group.small-btn-margin
%button.btn-sm.btn.btn-success.dropdown-toggle{ 'data-toggle' => 'dropdown', class: ('disabled' if @group_community_custom_fields.empty?) }
= t('.additional_forms')
%span.caret
%ul.dropdown-menu.scrollable-dropdown-menu
- @group_community_custom_fields.each do |_, community_custom_fields|
%li
%p= link_to community_custom_fields.first.custom_field.form_title, community_custom_field_properties_path(@community, custom_field_id: community_custom_fields.first.custom_field_id)
.btn-group.small-btn-margin
%button.btn-sm.btn.btn-success.dropdown-toggle{ 'data-toggle' => 'dropdown', class: ('disabled' if @group_community_custom_fields.empty?) }
= t('.additional_forms')
%span.caret
%ul.dropdown-menu.scrollable-dropdown-menu
- @group_community_custom_fields.each do |_, community_custom_fields|
%li
%p= link_to community_custom_fields.first.custom_field.form_title, community_custom_field_properties_path(@community, custom_field_id: community_custom_fields.first.custom_field_id)

- if can? :manage, CustomFieldProperty
.btn-group.small-btn-margin
%button.btn-sm.btn.btn-success.dropdown-toggle{ 'data-toggle' => 'dropdown', class: ('disabled' if @free_community_forms.empty?) }
= t('.add_form')
%span.caret
%ul.dropdown-menu.scrollable-dropdown-menu
- @free_community_forms.each do |custom_field|
%li
%p= link_to custom_field.form_title, new_community_custom_field_property_path(@community, custom_field_id: custom_field)
- if can? :manage, CustomFieldProperty
.btn-group.small-btn-margin
%button.btn-sm.btn.btn-success.dropdown-toggle{ 'data-toggle' => 'dropdown', class: ('disabled' if @free_community_forms.empty?) }
= t('.add_form')
%span.caret
%ul.dropdown-menu.scrollable-dropdown-menu
- @free_community_forms.each do |custom_field|
%li
%p= link_to custom_field.form_title, new_community_custom_field_property_path(@community, custom_field_id: custom_field)

.ibox.mini-margin
.ibox-title
4 changes: 3 additions & 1 deletion config/locales/en.yml
Original file line number Diff line number Diff line change
@@ -2228,6 +2228,8 @@ en:
new:
new_community_title: New Community
show:
add_form: Add Form
additional_forms: Community's Active Forms
address: Address
all_beneficiaries: To Count All Beneficiaries (direct members and their household members)
are_you_sure: Are you sure you want to delete?
@@ -3843,7 +3845,7 @@ en:
new_family_title: New Family
show:
add_form: Add Form
additional_forms: Community's Active Forms
additional_forms: Family's Active Forms
additional_info: Additional Information
address: Address
adult_name: Name of Adult Member
2 changes: 2 additions & 0 deletions config/locales/km.yml
Original file line number Diff line number Diff line change
@@ -2220,6 +2220,8 @@ km:
new:
new_community_title: New Community
show:
add_form: Add Form
additional_forms: Community's Active Forms
address: Address
all_beneficiaries: To Count All Beneficiaries (direct members and their household members)
are_you_sure: Are you sure you want to delete?
2 changes: 2 additions & 0 deletions config/locales/my.yml
Original file line number Diff line number Diff line change
@@ -2216,6 +2216,8 @@ my:
new:
new_community_title: New Community
show:
add_form: Add Form
additional_forms: Community's Active Forms
address: Address
all_beneficiaries: To Count All Beneficiaries (direct members and their household members)
are_you_sure: Are you sure you want to delete?
4 changes: 4 additions & 0 deletions spec/models/community_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
describe Community, 'associations' do
it { is_expected.to have_many(:custom_field_properties).dependent(:destroy) }
it { is_expected.to have_many(:custom_fields).through(:custom_field_properties) }
end