Skip to content

Commit

Permalink
Merge pull request wikirate#1634 from ethn/answerpage
Browse files Browse the repository at this point in the history
details
  • Loading branch information
ethn authored Jul 17, 2024
2 parents f72ca8a + 380ad46 commit fb1e6da
Show file tree
Hide file tree
Showing 44 changed files with 37,762 additions and 1,382 deletions.
37 changes: 22 additions & 15 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ GEM
dalli (3.2.8)
database_cleaner (2.0.2)
database_cleaner-active_record (>= 2, < 3)
database_cleaner-active_record (2.1.0)
database_cleaner-active_record (2.2.0)
activerecord (>= 5.a)
database_cleaner-core (~> 2.0.0)
database_cleaner-core (2.0.1)
Expand Down Expand Up @@ -512,14 +512,15 @@ GEM
erubis (2.7.0)
ethon (0.16.0)
ffi (>= 1.15.0)
excon (0.110.0)
excon (0.111.0)
execjs (2.9.1)
faraday (2.9.2)
faraday (2.10.0)
faraday-net_http (>= 2.0, < 3.2)
logger
faraday-net_http (3.1.0)
net-http
ffi (1.16.3)
fog-aws (3.23.0)
fog-aws (3.24.0)
fog-core (~> 2.1)
fog-json (~> 1.1)
fog-xml (~> 0.1)
Expand All @@ -543,7 +544,8 @@ GEM
haml (5.2.2)
temple (>= 0.8.0)
tilt
highline (3.0.1)
highline (3.1.0)
reline
html2haml (2.3.0)
erubis (~> 2.7.0)
haml (>= 4.0)
Expand Down Expand Up @@ -574,6 +576,7 @@ GEM
ruby-vips (>= 2.0.17, < 3)
image_size (2.1.2)
interception (0.5)
io-console (0.7.2)
iso8601 (0.13.0)
json (2.7.2)
jwt (2.8.2)
Expand Down Expand Up @@ -609,6 +612,7 @@ GEM
listen (3.9.0)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
logger (1.6.0)
loofah (2.22.0)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
Expand All @@ -623,7 +627,7 @@ GEM
mime-types (3.5.2)
mime-types-data (~> 3.2015)
mime-types-data (3.2024.0702)
mini_magick (4.13.1)
mini_magick (4.13.2)
mini_mime (1.1.5)
minitest (5.24.1)
multi_json (1.15.0)
Expand Down Expand Up @@ -665,11 +669,11 @@ GEM
ast
ruby-ll (~> 2.1)
open_uri_redirections (0.2.1)
opensearch-ruby (3.3.0)
opensearch-ruby (3.4.0)
faraday (>= 1.0, < 3)
multi_json (>= 1.0)
parallel (1.25.1)
parser (3.3.3.0)
parser (3.3.4.0)
ast (~> 2.4.1)
racc
pdfkit (0.8.7.3)
Expand Down Expand Up @@ -752,12 +756,14 @@ GEM
recaptcha (4.13.2)
json
regexp_parser (2.9.2)
reline (0.5.9)
io-console (~> 0.5)
rest-client (2.1.0)
http-accept (>= 1.7.0, < 2.0)
http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 4.0)
netrc (~> 0.8)
rexml (3.3.1)
rexml (3.3.2)
strscan
roo (2.10.1)
nokogiri (~> 1)
Expand Down Expand Up @@ -790,13 +796,13 @@ GEM
rspec-support (3.13.1)
rspec_junit_formatter (0.6.0)
rspec-core (>= 2, < 4, != 2.12.0)
rubocop (1.64.1)
rubocop (1.65.0)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
regexp_parser (>= 2.4, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.31.1, < 2.0)
ruby-progressbar (~> 1.7)
Expand All @@ -822,10 +828,11 @@ GEM
ast
ruby-prof (1.7.0)
ruby-progressbar (1.13.0)
ruby-vips (2.2.1)
ruby-vips (2.2.2)
ffi (~> 1.12)
logger
ruby2_keywords (0.0.5)
ruby_parser (3.21.0)
ruby_parser (3.21.1)
racc (~> 1.5)
sexp_processor (~> 4.16)
rubyzip (2.3.2)
Expand All @@ -840,7 +847,7 @@ GEM
rexml (~> 3.2, >= 3.2.5)
rubyzip (>= 1.2.2, < 3.0)
websocket (~> 1.0)
sexp_processor (4.17.1)
sexp_processor (4.17.2)
simplecov (0.22.0)
docile (~> 1.1)
simplecov-html (~> 0.11)
Expand Down Expand Up @@ -905,7 +912,7 @@ GEM
rubyzip (>= 1.3.0)
selenium-webdriver (~> 4.0, < 4.11)
webrick (1.8.1)
websocket (1.2.10)
websocket (1.2.11)
websocket-driver (0.7.6)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.thumbnail-subtitle
.subtitle-designer{ title: "Designer" }
= nest card.metric_designer_card, view: :thumbnail, size: :icon
.subtitle-scorer{ title: "Scorer" }
= nest card.scorer_card, view: :thumbnail, size: :icon
32 changes: 14 additions & 18 deletions mod/deckorate_calculations/set/metric_type/score/views.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,13 @@
class: "pointer-select _pointer-select")
end

view :scorer_image do
nest scorer_image_card, view: thumbnail_image_view,
title: card.scorer,
size: thumbnail_image_size
end
# view :scorer_image do
# nest scorer_image_card, view: thumbnail_image_view,
# title: card.scorer,
# size: thumbnail_image_size
# end

view :thumbnail_subtitle, template: :haml

def algorithm
format_algorithm algorithm_content
Expand All @@ -44,9 +46,9 @@ def algorithm_content
field_nest card.formula_field, view: :core
end

def scorer_image_card
scorer_card.fetch :image, new: { type: :image }
end
# def scorer_image_card
# scorer_card.fetch :image, new: { type: :image }
# end

def table_properties
{
Expand All @@ -59,7 +61,7 @@ def table_properties
end

def header_text
super + fixed_thumbnail_subtitle
super + metric_type_details
end

view :name_formgroup do
Expand Down Expand Up @@ -88,25 +90,19 @@ def score_name_help_text
"full metric name = [scored metric]+[your username]"
end

# def fixed_thumbnail_subtitle
# wrap_with :div, class: "scored-by-subtitle" do
# "Scored by #{link_to_card card.scorer}"
# end
# end

def scored_metric_property title
wrap_with :div, class: "row scored-metric-property" do
labeled title, nest(card.left, view: :thumbnail)
end
end

def scorer_property title
def scorer_property title, size=nil
wrap_with :div, class: "row scorer-property" do
labeled title, nest(scorer_card, view: :thumbnail)
labeled title, nest(scorer_card, view: :thumbnail, size: size)
end
end

def autocomplete_label
"#{super}<small>#{fixed_thumbnail_subtitle}</small>"
"#{super}<small>#{metric_type_details}</small>"
end
end
38 changes: 38 additions & 0 deletions mod/deckorate_core/assets/script/customize_fields.js.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
$ ->
deckorate.customFields =
headquarters:
title: "Company Headquarters"
selector: ".TYPE-company.thumbnail .RIGHT-headquarter.content-view"
identifiers:
title: "Company Identifiers"
selector: ".TYPE-company.thumbnail .thumbnail-subtitle"
metric_type:
title: "Metric Type"
selector: ".TYPE-metric.thumbnail .thumbnail-title-right"
metric_designer:
title: "Metric Designer"
selector: ".TYPE-metric.thumbnail .thumbnail-subtitle"
contributor:
title: "Contributor"
selector: ".bar-middle .credit"

$("body").on "change", "._custom-field-checkboxes input", (e) ->
box = $(this)
selector = box.data "fieldSelector"
$(".answer-result-items").find(selector).toggle box.is(":checked")


decko.slot.ready (slot) ->
for field, config of deckorate.customFields
addInput slot, field, config

addInput = (slot, field, config) ->
input = slot.find("._custom-field-template .custom-field").clone()
id = "custom-field-" + field
box = input.find "input"
box.attr "id", id
box.data "fieldSelector", config["selector"]
label = input.find "label"
label.html config["title"]
label.attr "for", id
slot.find("._custom-field-checkboxes").append input
15 changes: 0 additions & 15 deletions mod/deckorate_core/assets/style/answers.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,6 @@
&.rich-header .media-body {
width: 100%;
}

&.bar {
.bar-left > {
div > div {
padding: 0 0.5em;

&.thumbnail {
width: 42%;
}
}
.one-thumb-answer > .thumbnail {
width: 84%;
}
}
}
}

.flag-details i {
Expand Down
Empty file.
2 changes: 1 addition & 1 deletion mod/deckorate_core/assets/style/metric_box.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
height: 320px;
.box-top {
min-height: 80px;
.thumbnail-title {
> .thumbnail-title {
padding-bottom: 0.5rem;
margin-bottom: 0.5rem;
border-bottom: 1px solid #eee;
Expand Down
48 changes: 24 additions & 24 deletions mod/deckorate_core/assets/style/metrics.scss
Original file line number Diff line number Diff line change
Expand Up @@ -45,30 +45,30 @@ fieldset > .RIGHT-Xmetric_type ul.pointer-radio-list > li {



.metric-thumbnail {
font-size: 0.66em;
font-weight: normal;
white-space: nowrap;
border: solid 1px $border-color;
display: inline-block;
padding: 7px;
margin-bottom: 8px;
img {
max-width: 35px;
max-height: 35px;
}
.thumbnail-image,
.thumbnail-text {
display: inline-block;
vertical-align: middle;
> a {
color: $gray-600;
}
a > div {
max-width: 225px;
}
}
}
//.metric-thumbnail {
// font-size: 0.66em;
// font-weight: normal;
// white-space: nowrap;
// border: solid 1px $border-color;
// display: inline-block;
// padding: 7px;
// margin-bottom: 8px;
// img {
// max-width: 35px;
// max-height: 35px;
// }
// .thumbnail-image,
// .thumbnail-text {
// display: inline-block;
// vertical-align: middle;
// > a {
// color: $gray-600;
// }
// a > div {
// max-width: 225px;
// }
// }
//}

.table > tbody > tr > td > .metric-thumbnail {
float: left;
Expand Down

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

Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def current_group

view :filtered_results_stats, cache: :never, template: :haml
view :filtered_results_chart, cache: :never, template: :haml
view :customize_filtered_panel, template: :haml
view :customize_filtered_panel, template: :haml, wrap: :slot
view :customize_filtered_button, template: :haml
view :sorting_header, template: :haml, cache: :never

Expand Down Expand Up @@ -118,6 +118,16 @@ def customize_item_options
none: "Individual Answers (No Grouping)" }
end

def show_hide_fields
{
headquarters: "Company Headquarters",
identifiers: "Company Identifiers",
metric_type: "Metric Type",
metric_designer: "Metric Designer",
contributor: "Contributor"
}
end

def grouped_result
with_paging do
search_with_params.map do |result|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,15 @@
class: "form-check-input", id: id
%label.form-check-label{ for: id }
= label

%hr
.form-check
%input#_all-custom-fields.form-check-input{ type: "checkbox" }
%label.form-check-label{ for: "_all-custom-fields"}
%h6
%strong Custom fields
._custom-field-checkboxes.ps-4
._custom-field-template.d-none
.custom-field.form-check
%input.form-check-input{ type: "checkbox" }
%label.form-check-label
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@
.ps-1
+
= answer_count_badge :year, (answer_count - 1)
.bar-menu
= render :bar_menu
Loading

0 comments on commit fb1e6da

Please sign in to comment.