liquid_feedback_frontend

changeset 1754:22a75f55ff48

merge
author bsw
date Wed Oct 13 13:33:43 2021 +0200 (2021-10-13)
parents 85ee2f4ca9f2 6d69bc46440e
children 9043f24d872b
files
line diff
     1.1 --- a/app/main/api/member.lua	Wed Oct 13 13:33:23 2021 +0200
     1.2 +++ b/app/main/api/member.lua	Wed Oct 13 13:33:43 2021 +0200
     1.3 @@ -54,6 +54,23 @@
     1.4    selector:add_where{ "name ILIKE ? OR identification ILIKE ?", search, search }
     1.5  end
     1.6  
     1.7 +if app.scopes.read_profiles then
     1.8 +  local profile_lookups = false
     1.9 +  for i, field in ipairs(config.member_profile_fields) do
    1.10 +    if field.api_lookup then
    1.11 +      local value = param.get("profile_" .. field.id)
    1.12 +      if value then
    1.13 +        selector:add_where{ "member_profile.profile->>? = ?", field.id, value }
    1.14 +        profile_lookups = true
    1.15 +      end
    1.16 +    end
    1.17 +  end
    1.18 +  if profile_lookups then
    1.19 +    selector:join("member_profile", nil, "member_profile.member_id = member.id")
    1.20 +  end
    1.21 +end
    1.22 +
    1.23 +
    1.24  local members = selector:exec()
    1.25  local r = json.object()
    1.26  r.result = execute.chunk{ module = "api", chunk = "_member", params = { 
     2.1 --- a/app/main/survey/participate.lua	Wed Oct 13 13:33:23 2021 +0200
     2.2 +++ b/app/main/survey/participate.lua	Wed Oct 13 13:33:43 2021 +0200
     2.3 @@ -9,6 +9,7 @@
     2.4  end
     2.5  
     2.6  local question
     2.7 +local question_number = #survey.questions
     2.8  
     2.9  if survey_member then
    2.10    local answer_set = survey_member.answer_set
    2.11 @@ -20,6 +21,7 @@
    2.12      for i, q in ipairs(survey.questions) do
    2.13        if not question and not answers_by_question_id[q.id] then
    2.14          question = q
    2.15 +        question_number = i - 1
    2.16        end
    2.17      end
    2.18    end
    2.19 @@ -30,15 +32,25 @@
    2.20    ui.cell_main{ content = function()
    2.21  
    2.22      ui.container{ attr = { class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp survey" }, content = function()
    2.23 -      ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function()
    2.24 +      ui.container{ attr = { class = "mdl-card__title" }, content = function()
    2.25          ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = function()
    2.26            if survey_member.finished then
    2.27              slot.put(survey.finished_title)
    2.28            else
    2.29 -            ui.tag{ content = question.question }
    2.30 +            ui.tag{ tag = "span", content = question.question }
    2.31 +            ui.tag{ attr = { class = "survey_counter" }, content = (question_number + 1) .. " / " .. #survey.questions }
    2.32            end
    2.33          end }
    2.34        end }
    2.35 +      slot.put('<div id = "progressbar1" style="width: 100%;" class = "mdl-progress mdl-js-progress"></div>')
    2.36 +      
    2.37 +      ui.script{ script = [[
    2.38 +        document.querySelector('#progressbar1').addEventListener('mdl-componentupgraded', 
    2.39 +            function() {
    2.40 +            this.MaterialProgress.setProgress(]] .. question_number / #survey.questions * 100 .. [[);
    2.41 +         }); 
    2.42 +      
    2.43 +      ]] }
    2.44        ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function()
    2.45          if survey_member.finished then
    2.46            ui.container{ content = function()
    2.47 @@ -62,6 +74,7 @@
    2.48                error = { mode = "forward", module = "survey", view = "participate" },
    2.49              },
    2.50              content = function()
    2.51 +            
    2.52                ui.field.hidden{ name = "question_id", value = question.id }
    2.53  
    2.54                if question.answer_type == "radio" then
     3.1 --- a/static/lf4.css	Wed Oct 13 13:33:23 2021 +0200
     3.2 +++ b/static/lf4.css	Wed Oct 13 13:33:43 2021 +0200
     3.3 @@ -741,6 +741,11 @@
     3.4    margin-top: 0;
     3.5  }
     3.6  
     3.7 +.survey_counter {
     3.8 +  position: absolute;;
     3.9 +  right: 20px;
    3.10 +}
    3.11 +
    3.12  .trace_list {
    3.13    margin-left: 10px;
    3.14    list-style-type: none;

Impressum / About Us