##// END OF EJS Templates
repo-auth-tokens: UX, set and disable to VCS scope if selected an repo from select2
marcink -
r2118:3991f1f4 default
parent child Browse files
Show More
@@ -699,6 +699,7 b' class UsersView(UserAppView):'
699 c.role_options = [(c.role_values, _("Role"))]
699 c.role_options = [(c.role_values, _("Role"))]
700 c.user_auth_tokens = AuthTokenModel().get_auth_tokens(
700 c.user_auth_tokens = AuthTokenModel().get_auth_tokens(
701 c.user.user_id, show_expired=True)
701 c.user.user_id, show_expired=True)
702 c.role_vcs = AuthTokenModel.cls.ROLE_VCS
702 return self._get_template_context(c)
703 return self._get_template_context(c)
703
704
704 def maybe_attach_token_scope(self, token):
705 def maybe_attach_token_scope(self, token):
@@ -159,6 +159,7 b' class MyAccountView(BaseAppView, DataGri'
159 c.role_options = [(c.role_values, _("Role"))]
159 c.role_options = [(c.role_values, _("Role"))]
160 c.user_auth_tokens = AuthTokenModel().get_auth_tokens(
160 c.user_auth_tokens = AuthTokenModel().get_auth_tokens(
161 c.user.user_id, show_expired=True)
161 c.user.user_id, show_expired=True)
162 c.role_vcs = AuthTokenModel.cls.ROLE_VCS
162 return self._get_template_context(c)
163 return self._get_template_context(c)
163
164
164 def maybe_attach_token_scope(self, token):
165 def maybe_attach_token_scope(self, token):
@@ -141,6 +141,12 b' var repoFilter = function(data) {'
141
141
142 $("#scope_repo_id_disabled").select2(select2Options);
142 $("#scope_repo_id_disabled").select2(select2Options);
143
143
144 var selectVcsScope = function() {
145 // select vcs scope and disable input
146 $("#role").select2("val", "${c.role_vcs}").trigger('change');
147 $("#role").select2("readonly", true)
148 };
149
144 $("#scope_repo_id").select2({
150 $("#scope_repo_id").select2({
145 cachedDataSource: {},
151 cachedDataSource: {},
146 minimumInputLength: 2,
152 minimumInputLength: 2,
@@ -174,6 +180,9 b' var repoFilter = function(data) {'
174 }
180 }
175 })
181 })
176 });
182 });
183 $("#scope_repo_id").on('select2-selecting', function(e){
184 selectVcsScope()
185 });
177
186
178 });
187 });
179 </script>
188 </script>
@@ -139,6 +139,12 b' var repoFilter = function(data) {'
139
139
140 $("#scope_repo_id_disabled").select2(select2Options);
140 $("#scope_repo_id_disabled").select2(select2Options);
141
141
142 var selectVcsScope = function() {
143 // select vcs scope and disable input
144 $("#role").select2("val", "${c.role_vcs}").trigger('change');
145 $("#role").select2("readonly", true)
146 };
147
142 $("#scope_repo_id").select2({
148 $("#scope_repo_id").select2({
143 cachedDataSource: {},
149 cachedDataSource: {},
144 minimumInputLength: 2,
150 minimumInputLength: 2,
@@ -172,6 +178,9 b' var repoFilter = function(data) {'
172 }
178 }
173 })
179 })
174 });
180 });
181 $("#scope_repo_id").on('select2-selecting', function(e){
182 selectVcsScope()
183 });
175
184
176 });
185 });
177 </script>
186 </script>
General Comments 0
You need to be logged in to leave comments. Login now