Permalink
Browse files

Mass rename

  • Loading branch information...
1 parent 0cddaa9 commit 32af443a422843d864d329ce79b30e4637dc1f69 @MasseR committed Apr 7, 2013
Showing with 28 additions and 28 deletions.
  1. +14 −14 code/Main.hs
  2. +14 −14 code/public/js/doThings.js
View
@@ -129,27 +129,27 @@ parseThesis path = do
courses <- listToMaybe $ groupBy ((==) `on` fst) [T.breakOn " " course | course <- drop (n+1) contents']
return $ zipWith (\name course -> Thesis name (S.fromList $ map snd course)) names courses
-userModal :: Html
-userModal = H.div ! A.id "modal_user" ! A.class_ "modal hide fade" $ do
+studentModal :: Html
+studentModal = H.div ! A.id "modal_student" ! A.class_ "modal hide fade" $ do
H.div ! A.class_ "modal-header" $ do
H.button ! A.type_ "button" ! A.class_ "close" ! data_dismiss "modal" ! aria_hidden "true" $
"x"
- H.h3 ! A.id "user_header" $ mempty
- H.div ! A.class_ "modal-body" ! A.id "userBody" $ do
+ H.h3 ! A.id "student_header" $ mempty
+ H.div ! A.class_ "modal-body" ! A.id "studentBody" $ do
mempty
H.div ! A.class_ "modal-footer" $ do
H.a ! A.href "#" ! A.class_ "btn close" $ "Close"
where
data_dismiss = attribute "data-dismiss" "data-dismiss=\""
aria_hidden = attribute "aria-hidden" "aria-hidden=\""
-userQuery :: Mining Response
-userQuery = do
+studentQuery :: Mining Response
+studentQuery = do
students <- gets students
- id' <- lookText "userId"
- let user = M.lookup id' students
- case user of
- Just user' -> ok $ toResponse $ toJSON user'
+ id' <- lookText "studentId"
+ let student = M.lookup id' students
+ case student of
+ Just student' -> ok $ toResponse $ toJSON student'
Nothing -> notFound $ toResponse $ notFoundView $
H.p "User is not found"
@@ -198,7 +198,7 @@ notFoundView inner = H.docTypeHtml $ do
H.link ! A.href "/static/css/style.css" ! A.rel "stylesheet"
H.link ! A.href "/static/bootstrap/css/bootstrap-responsive.css" ! A.rel "stylesheet"
H.link ! A.href "http://code.jquery.com/ui/1.10.2/themes/smoothness/jquery-ui.css" ! A.rel "stylesheet"
- H.script ! A.type_ "text/html" ! A.id "user-template" $
+ H.script ! A.type_ "text/html" ! A.id "student-template" $
H.div mempty
H.body $ do
H.h1 "404 Not found"
@@ -237,7 +237,7 @@ mainView students = H.docTypeHtml $ do
H.script ! A.type_ "application/javascript" ! A.src "/static/mustache/mustache.js" $ mempty
H.script ! A.type_ "application/javascript" ! A.src "http://datatables.net/download/build/jquery.dataTables.nightly.js" $ mempty
H.script ! A.type_ "application/javascript" ! A.src "/static/js/doThings.js" $ mempty
- H.script ! A.type_ "text/html" ! A.id "userModalTemplate" $
+ H.script ! A.type_ "text/html" ! A.id "studentModalTemplate" $
H.div ! A.class_ "fluid-row" $ do
H.div ! A.class_ "span4" $ do
H.h2 $ "{{name}}"
@@ -261,7 +261,7 @@ mainView students = H.docTypeHtml $ do
"Placeholder login text. What to do with this?"
H.ul ! A.class_ "nav" $ do
H.li $ "emptymenu"
- userModal
+ studentModal
H.div ! A.class_ "container-fluid" $ do
H.div ! A.class_ "row-fluid" $ do
H.div ! A.class_ "span8" $ do
@@ -304,7 +304,7 @@ main = do
decodeBody (defaultBodyPolicy "/tmp" 16384 16384 16384)
evalStateT (msum [
nullDir >> ok (toResponse $ mainView students)
- , dir "user" $ userQuery
+ , dir "student" $ studentQuery
, dirs "student/upload" $ studentsUpload
, dirs "student/data" $ studentsData
, dirs "thesis/upload" $ thesisUpload
View
@@ -4,9 +4,9 @@ $(document).ready(function() {
return $(ev.currentTarget).attr('data-target');
}).toProperty('students').skipDuplicates();
- // Initialize (users) datatables with constant data
- var modalTemplate = $("#userModalTemplate").text();
- var dusers = $("#databox").dataTable( {
+ // Initialize (students) datatables with constant data
+ var modalTemplate = $("#studentModalTemplate").text();
+ var dstudents = $("#databox").dataTable( {
"bJQueryUI": true,
"aaData" : studentData,
"aoColumns": [
@@ -20,8 +20,8 @@ $(document).ready(function() {
});
window.touchStudents = function() {
$.get("/student/data", function(data) {
- dusers.fnClearTable();
- dusers.fnAddData(data);
+ dstudents.fnClearTable();
+ dstudents.fnAddData(data);
});
};
@@ -33,24 +33,24 @@ $(document).ready(function() {
return true;
return false;
}).map(function(ev) {
- return dusers.fnGetData(ev.currentTarget);
+ return dstudents.fnGetData(ev.currentTarget);
});
- var userQueries = dataClicks.flatMap(function(data) {
- return Bacon.fromPromise($.get("/user", {userId: data[0]}));
+ var studentQueries = dataClicks.flatMap(function(data) {
+ return Bacon.fromPromise($.get("/student", {studentId: data[0]}));
}).map(function(json) {
return Mustache.render(modalTemplate, json);
}).toProperty("");
- var userModalClose = $("#modal_user a.close").asEventStream("click").map(false);
- var userModalOpen = dataClicks.map(true);
+ var studentModalClose = $("#modal_student a.close").asEventStream("click").map(false);
+ var studentModalOpen = dataClicks.map(true);
- userModalClose.merge(userModalOpen).skipDuplicates().onValue(function(open) {
+ studentModalClose.merge(studentModalOpen).skipDuplicates().onValue(function(open) {
console.log(open);
if(open)
- $("#modal_user").modal('show');
+ $("#modal_student").modal('show');
else
- $("#modal_user").modal('hide');
+ $("#modal_student").modal('hide');
});
- userQueries.assign($('#userBody'), 'html');
+ studentQueries.assign($('#studentBody'), 'html');
});

0 comments on commit 32af443

Please sign in to comment.