{"action":"created","comment":{"url":"https://api.github.com/repos/nijel/weblate/pulls/comments/52756595","id":52756595,"diff_hunk":"@@ -496,6 +496,30 @@ class Profile(models.Model):\n         default=False\n     )\n \n+    DASHBOARD_SUBSCRIPTIONS = \"your-subscriptions\"\n+    DASHBOARD_LANGUAGES = \"your-languages\"\n+    DASHBOARD_ALL = \"projects\"\n+    DASHBOARD_COMPONENT_LIST = \"list\"\n+    DASHBOARD_CHOICES = (\n+        (DASHBOARD_SUBSCRIPTIONS, _('Your subscriptions')),\n+        (DASHBOARD_LANGUAGES, _('Your languages')),\n+        (DASHBOARD_ALL, _('All projects')),\n+        (DASHBOARD_COMPONENT_LIST, _('Component list')),\n+    )\n+    dashboard_view = models.CharField(\n+        max_length=100,\n+        choices=DASHBOARD_CHOICES,\n+        verbose_name=_('Default dashboard view'),\n+        default=DASHBOARD_SUBSCRIPTIONS,\n+    )","path":"weblate/accounts/models.py","position":19,"original_position":19,"commit_id":"18911fb0ebbcf866d959ac7a454a5ead9d5d6464","original_commit_id":"44cbfbbf7037a0d3be44390165b59c319eb34e0e","user":{"login":"matejcik","id":596073,"avatar_url":"https://avatars.githubusercontent.com/u/596073?v=3","gravatar_id":"","url":"https://api.github.com/users/matejcik","html_url":"https://github.com/matejcik","followers_url":"https://api.github.com/users/matejcik/followers","following_url":"https://api.github.com/users/matejcik/following{/other_user}","gists_url":"https://api.github.com/users/matejcik/gists{/gist_id}","starred_url":"https://api.github.com/users/matejcik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matejcik/subscriptions","organizations_url":"https://api.github.com/users/matejcik/orgs","repos_url":"https://api.github.com/users/matejcik/repos","events_url":"https://api.github.com/users/matejcik/events{/privacy}","received_events_url":"https://api.github.com/users/matejcik/received_events","type":"User","site_admin":false},"body":"The problem is that these strings are listed explicitly in index.html, and also show up in URLs. \"dashboard-1\" would be pretty ugly for one, and confusing in the html code too. So we actually need the symbolic names _and_ the slug values. That is why we chose to put the slug values in the database directly; there is actually no place where numeric id is of any use.\r\n\r\nWe could decide to ignore the \"ugly URL\" thing, and use symbolic names in the html source, but that doesn't seem to lead to clarity either: `<a href=\"#dashboard-{{ Profile.DASHBOARD_SUBSCRIPTIONS}}\">` is worse than `<a href=\"#subscriptions\">` IMHO.\r\n\r\nA possibility is to use a translation table between ids and slugs, or some sort of function to return slug given the ID, or label given the ID, and a list of slugs from which to generate the drop-down menu... I don't have a clear idea how to do this and where to put the resulting code though.\r\nHints? :)\r\n\r\nNote that we expect the `active_tab` properties to be reusable on other pages, namely settings (#990). That's why we chose the generic names.","created_at":"2016-02-12T15:44:22Z","updated_at":"2016-02-12T15:44:22Z","html_url":"https://github.com/nijel/weblate/pull/989#discussion_r52756595","pull_request_url":"https://api.github.com/repos/nijel/weblate/pulls/989","_links":{"self":{"href":"https://api.github.com/repos/nijel/weblate/pulls/comments/52756595"},"html":{"href":"https://github.com/nijel/weblate/pull/989#discussion_r52756595"},"pull_request":{"href":"https://api.github.com/repos/nijel/weblate/pulls/989"}}},"pull_request":{"url":"https://api.github.com/repos/nijel/weblate/pulls/989","id":58619272,"html_url":"https://github.com/nijel/weblate/pull/989","diff_url":"https://github.com/nijel/weblate/pull/989.diff","patch_url":"https://github.com/nijel/weblate/pull/989.patch","issue_url":"https://api.github.com/repos/nijel/weblate/issues/989","number":989,"state":"open","locked":false,"title":"Custom views","user":{"login":"jitka","id":351946,"avatar_url":"https://avatars.githubusercontent.com/u/351946?v=3","gravatar_id":"","url":"https://api.github.com/users/jitka","html_url":"https://github.com/jitka","followers_url":"https://api.github.com/users/jitka/followers","following_url":"https://api.github.com/users/jitka/following{/other_user}","gists_url":"https://api.github.com/users/jitka/gists{/gist_id}","starred_url":"https://api.github.com/users/jitka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jitka/subscriptions","organizations_url":"https://api.github.com/users/jitka/orgs","repos_url":"https://api.github.com/users/jitka/repos","events_url":"https://api.github.com/users/jitka/events{/privacy}","received_events_url":"https://api.github.com/users/jitka/received_events","type":"User","site_admin":false},"body":"This is our first attempt at writing custom views (should fix #865 when done).\r\nWe have extended the \"Your translations\" button. Now it is a drop-down that contains Projects, Your translations (all projects with your languages), Your subscriptions (subscribed projects, possibly filtered by language), and component lists.\r\nWe created a new model for component lists and the corresponding admin interface.\r\nComponent selection in the admin view is somewhat ugly (in Django 1.8 at least) -- do you know of a way to make the widget better? Now it's a plain `select` box where you have to ctrl+click everything. Maybe that thing from Users config for selecting user groups would be better.\r\n\r\nStill missing is:\r\n- user preference for the default view, plus a correct label for the dropdown :)\r\n- filtering component lists by language. If that is necessary.\r\n- maybe we should load component lists on demand, instead of hard-including into the index page, what do you think?\r\n- cleanups, pylint, tests and stuff like that. This is mergeable, but we will move the migration into a single file, update to master, etc.\r\n\r\nPlease have a look at this and let us know whether this is a good way of doing it :)","created_at":"2016-02-08T14:55:25Z","updated_at":"2016-02-12T15:44:22Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f2f2c5a96421ecc5d3586e913445ac8daf9ad647","assignee":{"login":"nijel","id":212189,"avatar_url":"https://avatars.githubusercontent.com/u/212189?v=3","gravatar_id":"","url":"https://api.github.com/users/nijel","html_url":"https://github.com/nijel","followers_url":"https://api.github.com/users/nijel/followers","following_url":"https://api.github.com/users/nijel/following{/other_user}","gists_url":"https://api.github.com/users/nijel/gists{/gist_id}","starred_url":"https://api.github.com/users/nijel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nijel/subscriptions","organizations_url":"https://api.github.com/users/nijel/orgs","repos_url":"https://api.github.com/users/nijel/repos","events_url":"https://api.github.com/users/nijel/events{/privacy}","received_events_url":"https://api.github.com/users/nijel/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/nijel/weblate/pulls/989/commits","review_comments_url":"https://api.github.com/repos/nijel/weblate/pulls/989/comments","review_comment_url":"https://api.github.com/repos/nijel/weblate/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nijel/weblate/issues/989/comments","statuses_url":"https://api.github.com/repos/nijel/weblate/statuses/18911fb0ebbcf866d959ac7a454a5ead9d5d6464","head":{"label":"jitka:cust_views","ref":"cust_views","sha":"18911fb0ebbcf866d959ac7a454a5ead9d5d6464","user":{"login":"jitka","id":351946,"avatar_url":"https://avatars.githubusercontent.com/u/351946?v=3","gravatar_id":"","url":"https://api.github.com/users/jitka","html_url":"https://github.com/jitka","followers_url":"https://api.github.com/users/jitka/followers","following_url":"https://api.github.com/users/jitka/following{/other_user}","gists_url":"https://api.github.com/users/jitka/gists{/gist_id}","starred_url":"https://api.github.com/users/jitka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jitka/subscriptions","organizations_url":"https://api.github.com/users/jitka/orgs","repos_url":"https://api.github.com/users/jitka/repos","events_url":"https://api.github.com/users/jitka/events{/privacy}","received_events_url":"https://api.github.com/users/jitka/received_events","type":"User","site_admin":false},"repo":{"id":47624172,"name":"weblate","full_name":"jitka/weblate","owner":{"login":"jitka","id":351946,"avatar_url":"https://avatars.githubusercontent.com/u/351946?v=3","gravatar_id":"","url":"https://api.github.com/users/jitka","html_url":"https://github.com/jitka","followers_url":"https://api.github.com/users/jitka/followers","following_url":"https://api.github.com/users/jitka/following{/other_user}","gists_url":"https://api.github.com/users/jitka/gists{/gist_id}","starred_url":"https://api.github.com/users/jitka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jitka/subscriptions","organizations_url":"https://api.github.com/users/jitka/orgs","repos_url":"https://api.github.com/users/jitka/repos","events_url":"https://api.github.com/users/jitka/events{/privacy}","received_events_url":"https://api.github.com/users/jitka/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jitka/weblate","description":"Web based translation tool with tight version control integration.","fork":true,"url":"https://api.github.com/repos/jitka/weblate","forks_url":"https://api.github.com/repos/jitka/weblate/forks","keys_url":"https://api.github.com/repos/jitka/weblate/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jitka/weblate/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jitka/weblate/teams","hooks_url":"https://api.github.com/repos/jitka/weblate/hooks","issue_events_url":"https://api.github.com/repos/jitka/weblate/issues/events{/number}","events_url":"https://api.github.com/repos/jitka/weblate/events","assignees_url":"https://api.github.com/repos/jitka/weblate/assignees{/user}","branches_url":"https://api.github.com/repos/jitka/weblate/branches{/branch}","tags_url":"https://api.github.com/repos/jitka/weblate/tags","blobs_url":"https://api.github.com/repos/jitka/weblate/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jitka/weblate/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jitka/weblate/git/refs{/sha}","trees_url":"https://api.github.com/repos/jitka/weblate/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jitka/weblate/statuses/{sha}","languages_url":"https://api.github.com/repos/jitka/weblate/languages","stargazers_url":"https://api.github.com/repos/jitka/weblate/stargazers","contributors_url":"https://api.github.com/repos/jitka/weblate/contributors","subscribers_url":"https://api.github.com/repos/jitka/weblate/subscribers","subscription_url":"https://api.github.com/repos/jitka/weblate/subscription","commits_url":"https://api.github.com/repos/jitka/weblate/commits{/sha}","git_commits_url":"https://api.github.com/repos/jitka/weblate/git/commits{/sha}","comments_url":"https://api.github.com/repos/jitka/weblate/comments{/number}","issue_comment_url":"https://api.github.com/repos/jitka/weblate/issues/comments{/number}","contents_url":"https://api.github.com/repos/jitka/weblate/contents/{+path}","compare_url":"https://api.github.com/repos/jitka/weblate/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jitka/weblate/merges","archive_url":"https://api.github.com/repos/jitka/weblate/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jitka/weblate/downloads","issues_url":"https://api.github.com/repos/jitka/weblate/issues{/number}","pulls_url":"https://api.github.com/repos/jitka/weblate/pulls{/number}","milestones_url":"https://api.github.com/repos/jitka/weblate/milestones{/number}","notifications_url":"https://api.github.com/repos/jitka/weblate/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jitka/weblate/labels{/name}","releases_url":"https://api.github.com/repos/jitka/weblate/releases{/id}","deployments_url":"https://api.github.com/repos/jitka/weblate/deployments","created_at":"2015-12-08T13:34:59Z","updated_at":"2016-02-04T15:14:47Z","pushed_at":"2016-02-12T14:17:35Z","git_url":"git://github.com/jitka/weblate.git","ssh_url":"git@github.com:jitka/weblate.git","clone_url":"https://github.com/jitka/weblate.git","svn_url":"https://github.com/jitka/weblate","homepage":"http://weblate.org/","size":168038,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"nijel:master","ref":"master","sha":"8d1cba5ece6ae18ff70d588e6444174bd7c5ec00","user":{"login":"nijel","id":212189,"avatar_url":"https://avatars.githubusercontent.com/u/212189?v=3","gravatar_id":"","url":"https://api.github.com/users/nijel","html_url":"https://github.com/nijel","followers_url":"https://api.github.com/users/nijel/followers","following_url":"https://api.github.com/users/nijel/following{/other_user}","gists_url":"https://api.github.com/users/nijel/gists{/gist_id}","starred_url":"https://api.github.com/users/nijel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nijel/subscriptions","organizations_url":"https://api.github.com/users/nijel/orgs","repos_url":"https://api.github.com/users/nijel/repos","events_url":"https://api.github.com/users/nijel/events{/privacy}","received_events_url":"https://api.github.com/users/nijel/received_events","type":"User","site_admin":false},"repo":{"id":3559019,"name":"weblate","full_name":"nijel/weblate","owner":{"login":"nijel","id":212189,"avatar_url":"https://avatars.githubusercontent.com/u/212189?v=3","gravatar_id":"","url":"https://api.github.com/users/nijel","html_url":"https://github.com/nijel","followers_url":"https://api.github.com/users/nijel/followers","following_url":"https://api.github.com/users/nijel/following{/other_user}","gists_url":"https://api.github.com/users/nijel/gists{/gist_id}","starred_url":"https://api.github.com/users/nijel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nijel/subscriptions","organizations_url":"https://api.github.com/users/nijel/orgs","repos_url":"https://api.github.com/users/nijel/repos","events_url":"https://api.github.com/users/nijel/events{/privacy}","received_events_url":"https://api.github.com/users/nijel/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nijel/weblate","description":"Web based translation tool with tight version control integration.","fork":false,"url":"https://api.github.com/repos/nijel/weblate","forks_url":"https://api.github.com/repos/nijel/weblate/forks","keys_url":"https://api.github.com/repos/nijel/weblate/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nijel/weblate/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nijel/weblate/teams","hooks_url":"https://api.github.com/repos/nijel/weblate/hooks","issue_events_url":"https://api.github.com/repos/nijel/weblate/issues/events{/number}","events_url":"https://api.github.com/repos/nijel/weblate/events","assignees_url":"https://api.github.com/repos/nijel/weblate/assignees{/user}","branches_url":"https://api.github.com/repos/nijel/weblate/branches{/branch}","tags_url":"https://api.github.com/repos/nijel/weblate/tags","blobs_url":"https://api.github.com/repos/nijel/weblate/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nijel/weblate/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nijel/weblate/git/refs{/sha}","trees_url":"https://api.github.com/repos/nijel/weblate/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nijel/weblate/statuses/{sha}","languages_url":"https://api.github.com/repos/nijel/weblate/languages","stargazers_url":"https://api.github.com/repos/nijel/weblate/stargazers","contributors_url":"https://api.github.com/repos/nijel/weblate/contributors","subscribers_url":"https://api.github.com/repos/nijel/weblate/subscribers","subscription_url":"https://api.github.com/repos/nijel/weblate/subscription","commits_url":"https://api.github.com/repos/nijel/weblate/commits{/sha}","git_commits_url":"https://api.github.com/repos/nijel/weblate/git/commits{/sha}","comments_url":"https://api.github.com/repos/nijel/weblate/comments{/number}","issue_comment_url":"https://api.github.com/repos/nijel/weblate/issues/comments{/number}","contents_url":"https://api.github.com/repos/nijel/weblate/contents/{+path}","compare_url":"https://api.github.com/repos/nijel/weblate/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nijel/weblate/merges","archive_url":"https://api.github.com/repos/nijel/weblate/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nijel/weblate/downloads","issues_url":"https://api.github.com/repos/nijel/weblate/issues{/number}","pulls_url":"https://api.github.com/repos/nijel/weblate/pulls{/number}","milestones_url":"https://api.github.com/repos/nijel/weblate/milestones{/number}","notifications_url":"https://api.github.com/repos/nijel/weblate/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nijel/weblate/labels{/name}","releases_url":"https://api.github.com/repos/nijel/weblate/releases{/id}","deployments_url":"https://api.github.com/repos/nijel/weblate/deployments","created_at":"2012-02-27T09:33:29Z","updated_at":"2016-02-02T14:20:21Z","pushed_at":"2016-02-12T14:17:36Z","git_url":"git://github.com/nijel/weblate.git","ssh_url":"git@github.com:nijel/weblate.git","clone_url":"https://github.com/nijel/weblate.git","svn_url":"https://github.com/nijel/weblate","homepage":"http://weblate.org/","size":168216,"stargazers_count":423,"watchers_count":423,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":134,"mirror_url":null,"open_issues_count":106,"forks":134,"open_issues":106,"watchers":423,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/nijel/weblate/pulls/989"},"html":{"href":"https://github.com/nijel/weblate/pull/989"},"issue":{"href":"https://api.github.com/repos/nijel/weblate/issues/989"},"comments":{"href":"https://api.github.com/repos/nijel/weblate/issues/989/comments"},"review_comments":{"href":"https://api.github.com/repos/nijel/weblate/pulls/989/comments"},"review_comment":{"href":"https://api.github.com/repos/nijel/weblate/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nijel/weblate/pulls/989/commits"},"statuses":{"href":"https://api.github.com/repos/nijel/weblate/statuses/18911fb0ebbcf866d959ac7a454a5ead9d5d6464"}}}}