{"action":"created","comment":{"url":"https://api.github.com/repos/yast/yast-installation/pulls/comments/175680027","pull_request_review_id":105246996,"id":175680027,"diff_hunk":"@@ -210,114 +212,59 @@ def roles(refresh: false)\n       SystemRole.all\n     end\n \n-    # Returns the content for the role buttons according to the available space\n+    # Returns the content for the role buttons\n     #\n-    # @param separation  [Integer] Separation between roles\n-    # @param indentation [Integer] Roles indentation\n-    # @param margin      [Integer] Top marging\n-    # @param description [Boolean] Indicates whether the description should be included\n     # @return [Yast::Term] Role buttons\n-    def role_buttons_content(margin: 2, indentation: 4, separation: 2, description: true, show_intro: true)\n+    def role_buttons(selected_role_id: nil)\n       box = []\n-      box << Left(Label(Yast::ProductControl.GetTranslatedText(\"roles_text\"))) if show_intro\n-      box << VSpacing(margin) unless margin.zero?\n+      box << Left(Label(Yast::ProductControl.GetTranslatedText(\"roles_text\")))\n+      box << VSpacing(2)\n \n-      ui_roles = roles.each_with_object(box) do |role, vbox|\n+      role_rt_radios = roles.map do |role|\n         # FIXME: following workaround can be removed as soon as bsc#997402 is fixed:\n         # bsc#995082: System role descriptions use a character that is missing in console font\n-        role_description = Yast::UI.TextMode ? role.description.tr(\"•\", \"*\") : role.description\n-        vbox << Left(RadioButton(Id(role.id), role.label))\n-        vbox << HBox(HSpacing(indentation), Left(Label(role_description))) if description\n-        vbox << VSpacing(separation) unless roles.last == role || separation.zero?\n-      end\n-\n-      RadioButtonGroup(Id(:roles), VBox(*ui_roles))\n-    end\n+        description = Yast::UI.TextMode ? role.description.tr(\"•\", \"*\") : role.description\n \n-    # Default role buttons options for the Qt UI\n-    DEFAULT_ROLE_BUTTONS_QT_OPTS = {\n-      indentation: 4,\n-      margin:      2,\n-      separation:  2,\n-      show_intro:  true,\n-      description: true\n-    }.freeze\n-\n-    # Default role buttons options for the textmode UI\n-    DEFAULT_ROLE_BUTTONS_TEXT_OPTS = {\n-      indentation: 2,\n-      margin:      1,\n-      separation:  2,\n-      show_intro:  true,\n-      description: true\n-    }.freeze\n-\n-    def intro_text\n-      @intro_text ||= Yast::ProductControl.GetTranslatedText(\"roles_text\")\n+        rb = richtext_radiobutton(id:       role.id,\n+                                  label:    role.label,\n+                                  selected: role.id == selected_role_id)\n+        description = description.lines.map { |l| l + \"<br>\" }.join \"\\n\"\n+        \"<p></p>#{rb}<p></p><ul>#{description}</ul>\"\n+      end\n+      box << RichText(Id(:rb), role_rt_radios.join(\"\\n\"))\n+      VBox(*box)\n     end\n \n-    # Space for roles\n-    #\n-    # @return [Hash] Options to distribute roles\n-    #\n-    # @see available_lines_for_roles\n-    def role_buttons_options\n-      return DEFAULT_ROLE_BUTTONS_QT_OPTS unless Yast::UI.TextMode\n-\n-      opts = textmode_role_buttons_options\n-      log.info \"Options for role buttons: #{opts.inspect}\"\n-      opts\n+    def richtext_radiobutton(id:, label:, selected:)\n+      if Yast::UI.TextMode\n+        richtext_radiobutton_tui(id: id, label: label, selected: selected)\n+      else\n+        richtext_radiobutton_gui(id: id, label: label, selected: selected)\n+      end\n     end\n \n-    # Returns space options for roles in textmode\n-    #\n-    # @return [Hash] Options to distribute roles\n-    def textmode_role_buttons_options\n-      opts = DEFAULT_ROLE_BUTTONS_TEXT_OPTS.dup\n-\n-      # Set separation\n-      separation = [\n-        DEFAULT_ROLE_BUTTONS_TEXT_OPTS[:separation],\n-        (available_lines_for_roles - needed_lines_for_roles - opts[:margin]) / 2\n-      ].min\n-      separation = 0 if separation < 0\n-      opts = DEFAULT_ROLE_BUTTONS_TEXT_OPTS.merge(separation: separation)\n-\n-      # Set intro size\n-      intro_lines = intro_text.lines.size\n-\n-      # No space for descriptions\n-      opts[:description] = false if needed_lines_for_roles > available_lines_for_roles\n-\n-      # No space for margin\n-      opts[:margin] = 0 if roles.size + intro_lines + opts[:margin] > available_lines_for_roles\n-\n-      # No space for intro\n-      opts[:show_intro] = false if roles.size + intro_lines > available_lines_for_roles\n-\n-      opts\n+    def richtext_radiobutton_tui(id:, label:, selected:)\n+      check = selected ? \"(x)\" : \"( )\"\n+      widget = \"#{check} #{label}\"\n+      enabled_widget = \"<a href=\\\"#{id}\\\">#{widget}</a>\"\n+      \"#{enabled_widget}<br>\"\n     end\n \n-    # Number of required lines to show roles information and buttons\n-    #\n-    # Title + Descriptions\n-    #\n-    # @return [Integer] Number of lines needed to display roles information\n-    def needed_lines_for_roles\n-      return @needed_lines_for_roles if @needed_lines_for_roles\n-      texts = roles.map(&:description)\n-      texts << intro_text unless intro_text.nil?\n-      lines_qty = texts.compact.map(&:lines).map(&:size).reduce(:+)\n-      @needed_lines_for_roles = roles.size + lines_qty\n+    BUTTON_ON = \"◉\".freeze # U+25C9 Fisheye","path":"src/lib/installation/select_system_role.rb","position":186,"original_position":186,"commit_id":"2ff3fe4d3f52ab243fb7eeff4f3b308c2f167cf4","original_commit_id":"2ff3fe4d3f52ab243fb7eeff4f3b308c2f167cf4","user":{"login":"lslezak","id":907998,"avatar_url":"https://avatars2.githubusercontent.com/u/907998?v=4","gravatar_id":"","url":"https://api.github.com/users/lslezak","html_url":"https://github.com/lslezak","followers_url":"https://api.github.com/users/lslezak/followers","following_url":"https://api.github.com/users/lslezak/following{/other_user}","gists_url":"https://api.github.com/users/lslezak/gists{/gist_id}","starred_url":"https://api.github.com/users/lslezak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lslezak/subscriptions","organizations_url":"https://api.github.com/users/lslezak/orgs","repos_url":"https://api.github.com/users/lslezak/repos","events_url":"https://api.github.com/users/lslezak/events{/privacy}","received_events_url":"https://api.github.com/users/lslezak/received_events","type":"User","site_admin":false},"body":"I'd rather use images instead of the Unicode symbols so the rich text radio buttons look exatly same as normal radio buttons:\r\n\r\n![](https://github.com/yast/yast-theme/blob/master/SLE/wizard/inst_radio-button-checked.png?raw=true) ([inst_radio-button-checked.png](https://github.com/yast/yast-theme/blob/master/SLE/wizard/inst_radio-button-checked.png))\r\n![](https://github.com/yast/yast-theme/blob/master/SLE/wizard/inst_radio-button-unchecked.png?raw=true) ([inst_radio-button-unchecked.png](https://github.com/yast/yast-theme/blob/master/SLE/wizard/inst_radio-button-unchecked.png))\r\n\r\nIt seems that there are no icons for the normal mode (see https://github.com/yast/yast-theme/tree/master/SLE/wizard) but that should not be a problem as this dialog is displayed only during installation. (We could use that Unicode trick as a fallback in normal mode.)\r\n\r\nSee the [image implementation](https://github.com/yast/yast-registration/blob/cc13812295556b2ec462fc68865d4fca287e1403/src/lib/registration/ui/addon_selection_base_dialog.rb#L181) in the registration dialog.","created_at":"2018-03-20T08:08:53Z","updated_at":"2018-03-20T08:09:07Z","html_url":"https://github.com/yast/yast-installation/pull/671#discussion_r175680027","pull_request_url":"https://api.github.com/repos/yast/yast-installation/pulls/671","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/yast/yast-installation/pulls/comments/175680027"},"html":{"href":"https://github.com/yast/yast-installation/pull/671#discussion_r175680027"},"pull_request":{"href":"https://api.github.com/repos/yast/yast-installation/pulls/671"}}},"pull_request":{"url":"https://api.github.com/repos/yast/yast-installation/pulls/671","id":175536381,"html_url":"https://github.com/yast/yast-installation/pull/671","diff_url":"https://github.com/yast/yast-installation/pull/671.diff","patch_url":"https://github.com/yast/yast-installation/pull/671.patch","issue_url":"https://api.github.com/repos/yast/yast-installation/issues/671","number":671,"state":"open","locked":false,"title":"Enable many, many roles (with a RichText widget)","user":{"login":"mvidner","id":102056,"avatar_url":"https://avatars3.githubusercontent.com/u/102056?v=4","gravatar_id":"","url":"https://api.github.com/users/mvidner","html_url":"https://github.com/mvidner","followers_url":"https://api.github.com/users/mvidner/followers","following_url":"https://api.github.com/users/mvidner/following{/other_user}","gists_url":"https://api.github.com/users/mvidner/gists{/gist_id}","starred_url":"https://api.github.com/users/mvidner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mvidner/subscriptions","organizations_url":"https://api.github.com/users/mvidner/orgs","repos_url":"https://api.github.com/users/mvidner/repos","events_url":"https://api.github.com/users/mvidner/events{/privacy}","received_events_url":"https://api.github.com/users/mvidner/received_events","type":"User","site_admin":false},"body":"- https://trello.com/c/WmjvFAZP\r\n- [bsc#1084674](https://bugzilla.suse.com/show_bug.cgi?id=1084674)\r\n\r\nQuick testing:\r\n```sh\r\nrake run[inst_system_role]\r\n```\r\nor\r\n```sh\r\nDISPLAY= rake run[inst_system_role]\r\n```\r\n\r\n![six-roles-gui](https://user-images.githubusercontent.com/102056/37607443-56e19a5c-2b98-11e8-8313-6ec10ce1ea9f.png)\r\n\r\n![six-roles-tui](https://user-images.githubusercontent.com/102056/37607454-600edd60-2b98-11e8-996b-f72724518e28.png)\r\n","created_at":"2018-03-16T13:43:25Z","updated_at":"2018-03-20T08:09:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d113c198275151431682dee4478c3ae598a498f3","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/yast/yast-installation/pulls/671/commits","review_comments_url":"https://api.github.com/repos/yast/yast-installation/pulls/671/comments","review_comment_url":"https://api.github.com/repos/yast/yast-installation/pulls/comments{/number}","comments_url":"https://api.github.com/repos/yast/yast-installation/issues/671/comments","statuses_url":"https://api.github.com/repos/yast/yast-installation/statuses/2ff3fe4d3f52ab243fb7eeff4f3b308c2f167cf4","head":{"label":"yast:infinite-roles","ref":"infinite-roles","sha":"2ff3fe4d3f52ab243fb7eeff4f3b308c2f167cf4","user":{"login":"yast","id":909990,"avatar_url":"https://avatars1.githubusercontent.com/u/909990?v=4","gravatar_id":"","url":"https://api.github.com/users/yast","html_url":"https://github.com/yast","followers_url":"https://api.github.com/users/yast/followers","following_url":"https://api.github.com/users/yast/following{/other_user}","gists_url":"https://api.github.com/users/yast/gists{/gist_id}","starred_url":"https://api.github.com/users/yast/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yast/subscriptions","organizations_url":"https://api.github.com/users/yast/orgs","repos_url":"https://api.github.com/users/yast/repos","events_url":"https://api.github.com/users/yast/events{/privacy}","received_events_url":"https://api.github.com/users/yast/received_events","type":"Organization","site_admin":false},"repo":{"id":4368120,"name":"yast-installation","full_name":"yast/yast-installation","owner":{"login":"yast","id":909990,"avatar_url":"https://avatars1.githubusercontent.com/u/909990?v=4","gravatar_id":"","url":"https://api.github.com/users/yast","html_url":"https://github.com/yast","followers_url":"https://api.github.com/users/yast/followers","following_url":"https://api.github.com/users/yast/following{/other_user}","gists_url":"https://api.github.com/users/yast/gists{/gist_id}","starred_url":"https://api.github.com/users/yast/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yast/subscriptions","organizations_url":"https://api.github.com/users/yast/orgs","repos_url":"https://api.github.com/users/yast/repos","events_url":"https://api.github.com/users/yast/events{/privacy}","received_events_url":"https://api.github.com/users/yast/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/yast/yast-installation","description":"YaST module installation","fork":false,"url":"https://api.github.com/repos/yast/yast-installation","forks_url":"https://api.github.com/repos/yast/yast-installation/forks","keys_url":"https://api.github.com/repos/yast/yast-installation/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yast/yast-installation/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yast/yast-installation/teams","hooks_url":"https://api.github.com/repos/yast/yast-installation/hooks","issue_events_url":"https://api.github.com/repos/yast/yast-installation/issues/events{/number}","events_url":"https://api.github.com/repos/yast/yast-installation/events","assignees_url":"https://api.github.com/repos/yast/yast-installation/assignees{/user}","branches_url":"https://api.github.com/repos/yast/yast-installation/branches{/branch}","tags_url":"https://api.github.com/repos/yast/yast-installation/tags","blobs_url":"https://api.github.com/repos/yast/yast-installation/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yast/yast-installation/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yast/yast-installation/git/refs{/sha}","trees_url":"https://api.github.com/repos/yast/yast-installation/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yast/yast-installation/statuses/{sha}","languages_url":"https://api.github.com/repos/yast/yast-installation/languages","stargazers_url":"https://api.github.com/repos/yast/yast-installation/stargazers","contributors_url":"https://api.github.com/repos/yast/yast-installation/contributors","subscribers_url":"https://api.github.com/repos/yast/yast-installation/subscribers","subscription_url":"https://api.github.com/repos/yast/yast-installation/subscription","commits_url":"https://api.github.com/repos/yast/yast-installation/commits{/sha}","git_commits_url":"https://api.github.com/repos/yast/yast-installation/git/commits{/sha}","comments_url":"https://api.github.com/repos/yast/yast-installation/comments{/number}","issue_comment_url":"https://api.github.com/repos/yast/yast-installation/issues/comments{/number}","contents_url":"https://api.github.com/repos/yast/yast-installation/contents/{+path}","compare_url":"https://api.github.com/repos/yast/yast-installation/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yast/yast-installation/merges","archive_url":"https://api.github.com/repos/yast/yast-installation/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yast/yast-installation/downloads","issues_url":"https://api.github.com/repos/yast/yast-installation/issues{/number}","pulls_url":"https://api.github.com/repos/yast/yast-installation/pulls{/number}","milestones_url":"https://api.github.com/repos/yast/yast-installation/milestones{/number}","notifications_url":"https://api.github.com/repos/yast/yast-installation/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yast/yast-installation/labels{/name}","releases_url":"https://api.github.com/repos/yast/yast-installation/releases{/id}","deployments_url":"https://api.github.com/repos/yast/yast-installation/deployments","created_at":"2012-05-18T10:23:52Z","updated_at":"2018-03-19T14:04:55Z","pushed_at":"2018-03-20T07:21:32Z","git_url":"git://github.com/yast/yast-installation.git","ssh_url":"git@github.com:yast/yast-installation.git","clone_url":"https://github.com/yast/yast-installation.git","svn_url":"https://github.com/yast/yast-installation","homepage":"http://en.opensuse.org/Portal:YaST","size":32563,"stargazers_count":5,"watchers_count":5,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":34,"mirror_url":null,"archived":false,"open_issues_count":4,"license":{"key":"gpl-2.0","name":"GNU General Public License v2.0","spdx_id":"GPL-2.0","url":"https://api.github.com/licenses/gpl-2.0"},"forks":34,"open_issues":4,"watchers":5,"default_branch":"master"}},"base":{"label":"yast:master","ref":"master","sha":"9b2510366907401ffc0e76933bafbe79a6a5648e","user":{"login":"yast","id":909990,"avatar_url":"https://avatars1.githubusercontent.com/u/909990?v=4","gravatar_id":"","url":"https://api.github.com/users/yast","html_url":"https://github.com/yast","followers_url":"https://api.github.com/users/yast/followers","following_url":"https://api.github.com/users/yast/following{/other_user}","gists_url":"https://api.github.com/users/yast/gists{/gist_id}","starred_url":"https://api.github.com/users/yast/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yast/subscriptions","organizations_url":"https://api.github.com/users/yast/orgs","repos_url":"https://api.github.com/users/yast/repos","events_url":"https://api.github.com/users/yast/events{/privacy}","received_events_url":"https://api.github.com/users/yast/received_events","type":"Organization","site_admin":false},"repo":{"id":4368120,"name":"yast-installation","full_name":"yast/yast-installation","owner":{"login":"yast","id":909990,"avatar_url":"https://avatars1.githubusercontent.com/u/909990?v=4","gravatar_id":"","url":"https://api.github.com/users/yast","html_url":"https://github.com/yast","followers_url":"https://api.github.com/users/yast/followers","following_url":"https://api.github.com/users/yast/following{/other_user}","gists_url":"https://api.github.com/users/yast/gists{/gist_id}","starred_url":"https://api.github.com/users/yast/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yast/subscriptions","organizations_url":"https://api.github.com/users/yast/orgs","repos_url":"https://api.github.com/users/yast/repos","events_url":"https://api.github.com/users/yast/events{/privacy}","received_events_url":"https://api.github.com/users/yast/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/yast/yast-installation","description":"YaST module installation","fork":false,"url":"https://api.github.com/repos/yast/yast-installation","forks_url":"https://api.github.com/repos/yast/yast-installation/forks","keys_url":"https://api.github.com/repos/yast/yast-installation/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yast/yast-installation/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yast/yast-installation/teams","hooks_url":"https://api.github.com/repos/yast/yast-installation/hooks","issue_events_url":"https://api.github.com/repos/yast/yast-installation/issues/events{/number}","events_url":"https://api.github.com/repos/yast/yast-installation/events","assignees_url":"https://api.github.com/repos/yast/yast-installation/assignees{/user}","branches_url":"https://api.github.com/repos/yast/yast-installation/branches{/branch}","tags_url":"https://api.github.com/repos/yast/yast-installation/tags","blobs_url":"https://api.github.com/repos/yast/yast-installation/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yast/yast-installation/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yast/yast-installation/git/refs{/sha}","trees_url":"https://api.github.com/repos/yast/yast-installation/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yast/yast-installation/statuses/{sha}","languages_url":"https://api.github.com/repos/yast/yast-installation/languages","stargazers_url":"https://api.github.com/repos/yast/yast-installation/stargazers","contributors_url":"https://api.github.com/repos/yast/yast-installation/contributors","subscribers_url":"https://api.github.com/repos/yast/yast-installation/subscribers","subscription_url":"https://api.github.com/repos/yast/yast-installation/subscription","commits_url":"https://api.github.com/repos/yast/yast-installation/commits{/sha}","git_commits_url":"https://api.github.com/repos/yast/yast-installation/git/commits{/sha}","comments_url":"https://api.github.com/repos/yast/yast-installation/comments{/number}","issue_comment_url":"https://api.github.com/repos/yast/yast-installation/issues/comments{/number}","contents_url":"https://api.github.com/repos/yast/yast-installation/contents/{+path}","compare_url":"https://api.github.com/repos/yast/yast-installation/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yast/yast-installation/merges","archive_url":"https://api.github.com/repos/yast/yast-installation/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yast/yast-installation/downloads","issues_url":"https://api.github.com/repos/yast/yast-installation/issues{/number}","pulls_url":"https://api.github.com/repos/yast/yast-installation/pulls{/number}","milestones_url":"https://api.github.com/repos/yast/yast-installation/milestones{/number}","notifications_url":"https://api.github.com/repos/yast/yast-installation/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yast/yast-installation/labels{/name}","releases_url":"https://api.github.com/repos/yast/yast-installation/releases{/id}","deployments_url":"https://api.github.com/repos/yast/yast-installation/deployments","created_at":"2012-05-18T10:23:52Z","updated_at":"2018-03-19T14:04:55Z","pushed_at":"2018-03-20T07:21:32Z","git_url":"git://github.com/yast/yast-installation.git","ssh_url":"git@github.com:yast/yast-installation.git","clone_url":"https://github.com/yast/yast-installation.git","svn_url":"https://github.com/yast/yast-installation","homepage":"http://en.opensuse.org/Portal:YaST","size":32563,"stargazers_count":5,"watchers_count":5,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":34,"mirror_url":null,"archived":false,"open_issues_count":4,"license":{"key":"gpl-2.0","name":"GNU General Public License v2.0","spdx_id":"GPL-2.0","url":"https://api.github.com/licenses/gpl-2.0"},"forks":34,"open_issues":4,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/yast/yast-installation/pulls/671"},"html":{"href":"https://github.com/yast/yast-installation/pull/671"},"issue":{"href":"https://api.github.com/repos/yast/yast-installation/issues/671"},"comments":{"href":"https://api.github.com/repos/yast/yast-installation/issues/671/comments"},"review_comments":{"href":"https://api.github.com/repos/yast/yast-installation/pulls/671/comments"},"review_comment":{"href":"https://api.github.com/repos/yast/yast-installation/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/yast/yast-installation/pulls/671/commits"},"statuses":{"href":"https://api.github.com/repos/yast/yast-installation/statuses/2ff3fe4d3f52ab243fb7eeff4f3b308c2f167cf4"}},"author_association":"OWNER"}}
{"actor":{"display_login":"lslezak"}}