Skip to content

Improve import project user experience #1695

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 52 commits into from
Oct 5, 2015
Merged
Show file tree
Hide file tree
Changes from 47 commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
790cf91
Allow public repositories to show when default privacy is private
agjohnson Sep 4, 2015
383812e
Somewhat working example of API driven list
agjohnson Sep 15, 2015
f7cf808
Add OAuth combination models
agjohnson Sep 18, 2015
89fa008
Add data migration for OAuth models
agjohnson Sep 18, 2015
6174067
Add missing constants
agjohnson Sep 18, 2015
6141c79
Redo html layout and add styling to import page
agjohnson Sep 19, 2015
71f06b8
Project service import filtering, error reporting, and form redirect
agjohnson Sep 21, 2015
38fece2
Style updates to project import page
agjohnson Sep 21, 2015
5a868ea
Add styling for buttons using icons
agjohnson Sep 21, 2015
61da2fb
Move projectimport to projects app
agjohnson Sep 21, 2015
618f531
Don't bold icons
agjohnson Sep 21, 2015
7632b80
Import path on project import.js
agjohnson Sep 21, 2015
1274409
Repo icon on project import
agjohnson Sep 22, 2015
1449e2b
Add combination github and bitbucket sync API endpoints
agjohnson Sep 22, 2015
63eed28
Update import HTML and move loader gif to static collect source
agjohnson Sep 22, 2015
878cb69
Remove Github/Bitbucket oauth models and related views
agjohnson Sep 22, 2015
10acc6f
Drop github/bitbucket migration
agjohnson Sep 22, 2015
bd2bc7e
Use a constant for project import providers
agjohnson Sep 22, 2015
64806e8
Tune remote import template
agjohnson Sep 23, 2015
3072372
Combine import project forms into a single interface
agjohnson Sep 23, 2015
ba641c8
Drop unused templates for import, repoint view template
agjohnson Sep 23, 2015
4f94890
Manual import button changes
agjohnson Sep 23, 2015
bf49fe2
Fix import fields on oauth models
agjohnson Sep 23, 2015
2ae3156
Find matches on oauth repo and display link to project instead
agjohnson Sep 24, 2015
fdf35c7
View icon on repo list, and turn buttons into links
agjohnson Sep 24, 2015
52fa9ca
Class cleanup
agjohnson Sep 24, 2015
6c02f0a
Adds a locked designation for repositories
agjohnson Sep 24, 2015
406e04d
Add exception to public task return, allowing for failures
agjohnson Sep 24, 2015
817c5cc
Improve github/bitbucket sync error responses a little bit
agjohnson Sep 24, 2015
90b7b7b
Fix oauth tests
agjohnson Sep 24, 2015
1d80490
More test fixes, linting
agjohnson Sep 25, 2015
06e532c
Rename OAuth* to Remote*
agjohnson Sep 25, 2015
079d153
Tune migration of github/bitbucket -> oauth model
agjohnson Sep 25, 2015
39708ed
Drop content type in migration as well
agjohnson Sep 25, 2015
f95a5d5
Remove lingering references to old model names
agjohnson Sep 25, 2015
7aa05fb
More migration updates
agjohnson Sep 25, 2015
bc62cd5
Fix migration even more
agjohnson Sep 25, 2015
9703a54
Repository naming in admin/etc
agjohnson Sep 25, 2015
7f3d7e8
Add privacy tests
agjohnson Sep 25, 2015
a3004bd
Lint fix on oauth utils
agjohnson Sep 25, 2015
466f823
Use public clone url on public github projects
agjohnson Sep 25, 2015
89cebb7
Lint on utils
agjohnson Sep 25, 2015
b5a544f
Style edits for .com styling
agjohnson Sep 26, 2015
988860b
Update javascript include paths in gulpfile
agjohnson Sep 28, 2015
38a0045
Cleanup on project import js
agjohnson Sep 28, 2015
dbb495c
Drop redundant model view queryset
agjohnson Sep 28, 2015
fa48743
Add fuzzy url search to remote repos back
agjohnson Sep 28, 2015
e90b501
Fix issue with fuzzy query
agjohnson Oct 2, 2015
ef2ca84
Add privacy changes for remote repos/orgs
agjohnson Oct 2, 2015
8fba74a
Fix filter on user query and api tests
agjohnson Oct 2, 2015
c9f6023
Add account context data on correct view
agjohnson Oct 2, 2015
e3f4c62
Add default scopes for GH into base settings
ericholscher Oct 5, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ var sources = {
core: {
'js/readthedocs-doc-embed.js': {expose: false},
'js/autocomplete.js': {},
'js/projectimport.js': {},
'css/badge_only.css': {src: 'bower_components/sphinx-rtd-theme/sphinx_rtd_theme/static/css/badge_only.css'},
'css/theme.css': {src: 'bower_components/sphinx-rtd-theme/sphinx_rtd_theme/static/css/theme.css'},

Expand All @@ -40,7 +39,11 @@ var sources = {
'font/fontawesome-webfont.woff': {src: 'bower_components/font-awesome/fonts/fontawesome-webfont.woff'},
'font/FontAwesome.otf': {src: 'bower_components/font-awesome/fonts/FontAwesome.otf'}
},
projects: {'js/tools.js': {}},
projects: {
'js/tools.js': {},
'js/import.js': {},
'css/import.less': {},
},
gold: {'js/gold.js': {}},
donate: {'js/donate.js': {}}
};
Expand Down Expand Up @@ -129,7 +132,9 @@ function build_app_sources (application, minify) {
function browserify_stream (file, config, cb_output) {
bower_resolve.offline = true;
bower_resolve.init(function () {
var bundle_stream = browserify();
var bundle_stream = browserify({
paths: ['./']
});

Object.keys(standalone).map(function (module) {
bundle_stream = bundle_stream.external(module);
Expand Down
87 changes: 87 additions & 0 deletions media/css/core.css
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ pre { margin: 15px 0; white-space: pre; overflow: auto; }
pre, code, tt { font-family: "inconsolata", "inconsolata-1", "inconsolata-2", 'bitstream vera sans mono', 'andale mono', 'lucida console', monospace; line-height: 20px; }
textarea, input, select { font-family: "inconsolata", "inconsolata-1", "inconsolata-2", 'bitstream vera sans mono', 'andale mono', 'lucida console', monospace; font-size: 16px; line-height: 20px; }

@font-face {
font-family: 'FontAwesome';
src: url('../fonts/fontawesome-webfont.eot?v=4.4.0');
src: url('../fonts/fontawesome-webfont.eot?#iefix&v=4.4.0') format('embedded-opentype'), url('../fonts/fontawesome-webfont.woff?v=4.4.0') format('woff'), url('../fonts/fontawesome-webfont.ttf?v=4.4.0') format('truetype'), url('../fonts/fontawesome-webfont.svg?v=4.4.0#fontawesomeregular') format('svg');
font-weight: normal;
font-style: normal;
}

/* tables */

Expand Down Expand Up @@ -593,6 +600,86 @@ div.project-version-list span.version-branch {
font-size: .9em;
}

/* Project import */
div.project-import-remote h1 {
margin: 0em 0em .5em 0em;
}

div.project-import-remote li.remote-repo a.remote-repo-view {
background: none;
color: #443;
box-shadow: none;
-moz-box-shadow: none;
-ms-box-shadow: none;
-webkit-box-shadow: none;
text-shadow: none;
}

div.project-import-remote li.remote-repo a.remote-repo-import,
div.project-import-remote li.remote-repo a.remote-repo-view,
div.project-import-remote li.remote-repo span.remote-repo-locked {
display: block;
margin: .25em 0em;
height: 1em;
padding: .5em .75em;
font-size: 1em;
font-weight: normal;
}

div.project-import-remote li.remote-repo a.remote-repo-import span,
div.project-import-remote li.remote-repo a.remote-repo-view span,
div.project-import-remote li.remote-repo span.remote-repo-locked span,
div.project-import-remote button.remote-sync span {
display: none;
}

div.project-import-remote li.remote-repo a.remote-repo-import:before {
font-family: FontAwesome;
font-weight: normal;
content: "\f067";
}
div.project-import-remote li.remote-repo a.remote-repo-view:before {
font-family: FontAwesome;
font-weight: normal;
content: "\f08e";
}
div.project-import-remote li.remote-repo span.remote-repo-locked:before {
font-family: FontAwesome;
font-weight: normal;
content: "\f023";
}
div.project-import-remote button.remote-sync:before {
font-family: FontAwesome;
content: "\f021";
}

div.project-import-remote form.import-connect-github button:before {
font-family: FontAwesome;
content: "\f09b";
}

div.project-import-remote form.import-connect-bitbucket button:before {
font-family: FontAwesome;
content: "\f171";
}

div.project-import-remote li.remote-repo span.remote-repo-extra-url:before {
padding-right: .5em;
font-family: FontAwesome;
font-size: 1.2em;
content: '\f126';
}
div.project-import-remote li.remote-repo span.remote-repo-extra-locked:before {
padding-right: .5em;
font-family: FontAwesome;
font-size: 1.2em;
content: '\f071';
}

div.project-import-sidebar form.import-manual input {
margin: .5em 0em 1.5em 0em;
}

/* Donate */
div.donate-stats {
padding: 2em;
Expand Down
37 changes: 20 additions & 17 deletions readthedocs/core/static-src/core/js/django-csrf.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,31 @@ function csrfSafeMethod(method) {
return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method));
}

function get_cookie(name) {
var cookieValue = null;
if (document.cookie && document.cookie != '') {
var cookies = document.cookie.split(';');
for (var i = 0; i < cookies.length; i++) {
var cookie = jQuery.trim(cookies[i]);
// Does this cookie string begin with the name we want?
if (cookie.substring(0, name.length + 1) == (name + '=')) {
cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
break;
}
}
}
return cookieValue;
}

$.ajaxSetup({
beforeSend: function(xhr, settings) {
if (!csrfSafeMethod(settings.type) && !this.crossDomain) {
function getCookie(name) {
var cookieValue = null;
if (document.cookie && document.cookie != '') {
var cookies = document.cookie.split(';');
for (var i = 0; i < cookies.length; i++) {
var cookie = jQuery.trim(cookies[i]);
// Does this cookie string begin with the name we want?
if (cookie.substring(0, name.length + 1) == (name + '=')) {
cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
break;
}
}
}
return cookieValue;
}
var csrftoken = getCookie('csrftoken');

var csrftoken = get_cookie('csrftoken');
xhr.setRequestHeader("X-CSRFToken", csrftoken);
}
}
});

module.exports = {
get_cookie: get_cookie
};
100 changes: 0 additions & 100 deletions readthedocs/core/static-src/core/js/projectimport.js

This file was deleted.

72 changes: 72 additions & 0 deletions readthedocs/core/static-src/core/js/tasks.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/* Public task tracking */

var jquery = require('jquery');

function poll_task (data) {
var defer = jquery.Deferred(),
tries = 5;

function poll_task_loop () {
jquery
.getJSON(data.url)
.success(function (task) {
if (task.finished) {
if (task.success) {
defer.resolve();
}
else {
defer.reject({message: task.error});
}
}
else {
setTimeout(poll_task_loop, 2000);
}
})
.error(function (error) {
console.error('Error polling task:', error);
tries -= 1;
if (tries > 0) {
setTimeout(poll_task_loop, 2000);
}
else {
var error_msg = error.responseJSON.detail || error.statusText;
defer.reject({message: error_msg});
}
});
}

setTimeout(poll_task_loop, 2000);

return defer;
}

function trigger_task (url) {
var defer = jquery.Deferred();

$.ajax({
method: 'POST',
url: url,
success: function (data) {
poll_task(data)
.then(function () {
defer.resolve();
})
.fail(function (error) {
// The poll_task function defer will only reject with
// normalized error objects
defer.reject(error);
});
},
error: function (error) {
var error_msg = error.responseJSON.detail || error.statusText;
defer.reject({message: error_msg});
}
});

return defer;
}

module.exports = {
poll_task: poll_task,
trigger_task: trigger_task
};
File renamed without changes
1 change: 0 additions & 1 deletion readthedocs/core/static/core/js/projectimport.js

This file was deleted.

Loading