Work on courses
authorSteve Sutton <steve@gaslightmedia.com>
Thu, 26 Feb 2015 15:41:33 +0000 (10:41 -0500)
committerSteve Sutton <steve@gaslightmedia.com>
Thu, 26 Feb 2015 15:41:33 +0000 (10:41 -0500)
Adding sortable and the accordion from jquery ui

Toolkit/Members/Admin/EditCourses.php
Toolkit/Members/RecordNavigation.php
Toolkit/Members/css/member-admin.css
Toolkit/Members/libjs/edit-member-course.js
Toolkit/Members/templates/editCourse.tpl
Toolkit/Members/templates/editCourses.tpl

index 8777baf..356c315 100644 (file)
@@ -1047,6 +1047,7 @@ class EditAdminCourse extends Toolkit_FormBuilder
      * @access protected
      */
     protected $courseId;
+    protected $courseName;
 
     /**
      * Description for protected
@@ -1168,10 +1169,7 @@ class EditAdminCourse extends Toolkit_FormBuilder
              WHERE id = {$this->courseId}";
 
         $defaults = $this->dbh->query($sql)->fetch(PDO::FETCH_ASSOC);
-        //var_dump($this->courseId);
-        if ($this->courseId === 10) {
-            //echo '<pre>'.print_r($defaults, true).'</pre>';exit;
-        }
+        $this->courseName = ($defaults['title']) ? 'Course - ' . $defaults['title'] : 'Course';
         $defaults['curr_image_rmv'] = $defaults['image'];
         $img = '<img src="%s">';
         $defaults['curr_image'] = sprintf($img, MEMBER_PHOTOS . $defaults['image']);
@@ -1499,6 +1497,7 @@ class EditAdminCourse extends Toolkit_FormBuilder
         $this->accept($renderer);
         $this->view               = new stdClass();
         $this->view->courseId     = $this->courseId;
+        $this->view->courseName   = $this->courseName;
         $this->view->showCurrImg  = $this->showCurrImg;
         $this->view->showCurrFile = $this->showCurrFile;
         $this->view->form         = $renderer->toObject();
index f6e8d0d..9be53b6 100644 (file)
@@ -127,9 +127,9 @@ class Toolkit_Members_RecordNavigation
                 'desc' => "View and edit $singularType categories",
             );
             $nav['courses'] = array(
-                'title' => 'Course Profile',
+                'title' => 'Course Profiles',
                 'url'   => "/members.php?$params",
-                'desc'  => "View and edit $singularType Course Profile",
+                'desc'  => "View and edit $singularType Course Profiles",
             );
             $nav['amenities'] = array(
                 'title' => 'Amenities',
@@ -248,9 +248,9 @@ class Toolkit_Members_RecordNavigation
                 'desc' => "View and edit $singularType categories",
             ),
             'courses' => array(
-                'title' => 'Course Profile',
+                'title' => 'Course Profiles',
                 'url'   => "/?$params",
-                'desc'  => "View and edit $singularType Course Profile",
+                'desc'  => "View and edit $singularType Course Profiles",
             ),
             'amenities' => array(
                 'title' => 'Amenities',
index c797f7b..ba9a8cb 100755 (executable)
@@ -972,3 +972,10 @@ label.pendingUpdate {
     margin-right: 10px;
 }
 .tree li a {background-image: url("../../../images/note_edit.png");}
+.ui-icon {
+    float: left;
+}
+.ui-accordion-content, .ui-widget-content  {
+    background: none !important;
+    background-color: #d6dfc3 !important;
+}
index 168d5bb..23d99d0 100755 (executable)
@@ -17,18 +17,26 @@ var MemberCourses =
             });
         }
 
-        $('div.container').sortable({
-            placeholder: 'ui-state-highlight',
-            //handle: 'div.packageItem',
-            opacity: 0.6,
-            revert: true,
-            scroll: true,
-            tolerance: 'pointer',
-            zIndex: 5,
-            axis: 'y',
-            cursor: 'n-resize',
-            update: MemberCourses.updatePos
-        });
+        $('#packageList').accordion({
+                //active: false,
+                header: "> div > h3",
+                collapsible: true,
+                //icons: false
+            })
+            .sortable({
+                placeholder: 'ui-state-highlight',
+                handle: 'h3',
+                opacity: 0.6,
+                revert: true,
+                scroll: true,
+                tolerance: 'pointer',
+                zIndex: 5,
+                axis: 'y',
+                cursor: 'n-resize',
+                update: MemberCourses.updatePos,
+                cancel: '#courseAddForm'
+            });
+
     },
 
     updatePos: function(event, ui)
index 569a84e..3575ce5 100644 (file)
-<div id="courses_{courseId}" class="packageItem packageUploadForm">
-    <span class="ui-icon ui-icon-arrowthick-2-n-s"></span>
-    {form.javascript:h}
-    {form.outputHeader():h}
-    {form.hidden:h}
-        <div class="courseText">
-            <i>{form.title.label:h}</i>
-            <div flexy:if="form.title.error" class="req">
-                {form.title.error:h}
+<div id="courses_{courseId}" class="group">
+    <h3>{courseName}</h3>
+    <div class="packageItem packageUploadForm">
+        {form.javascript:h}
+        {form.outputHeader():h}
+        {form.hidden:h}
+            <div class="courseText">
+                <i>{form.title.label:h}</i>
+                <div flexy:if="form.title.error" class="req">
+                    {form.title.error:h}
+                </div>
+                {form.title.html:h}
+                <i>{form.description.label:h}</i>
+                <div flexy:if="form.description.error" class="req">
+                    {form.description.error:h}
+                </div>
+                {form.description.html:h}
+                <i>
+                    <span class="req" flexy:if="form.sdate.required">*</span>
+                    {form.sdate.label:h}
+                </i>
+                <div flexy:if="form.sdate.error" class="req">
+                    {form.sdate.error:h}
+                </div>
+                {form.sdate.html:h}
+                <i>
+                    <span class="req" flexy:if="form.edate.required">*</span>
+                    {form.edate.label:h}
+                </i>
+                <div flexy:if="form.edate.error" class="req">
+                    {form.edate.error:h}
+                </div>
+                {form.edate.html:h}
             </div>
-            {form.title.html:h}
-            <i>{form.description.label:h}</i>
-            <div flexy:if="form.description.error" class="req">
-                {form.description.error:h}
-            </div>
-            {form.description.html:h}
-            <i>
-                <span class="req" flexy:if="form.sdate.required">*</span>
-                {form.sdate.label:h}
-            </i>
-            <div flexy:if="form.sdate.error" class="req">
-                {form.sdate.error:h}
-            </div>
-            {form.sdate.html:h}
-            <i>
-                <span class="req" flexy:if="form.edate.required">*</span>
-                {form.edate.label:h}
-            </i>
-            <div flexy:if="form.edate.error" class="req">
-                {form.edate.error:h}
-            </div>
-            {form.edate.html:h}
-        </div>
-        <div class="coursePhoto">
-            <div flexy:if="showCurrImg">
-                <label>
-                    {form.remove_img_rmv.html:h}
-                    {form.remove_img_rmv.label:h}
-                </label>
+            <div class="coursePhoto">
+                <div flexy:if="showCurrImg">
+                    <label>
+                        {form.remove_img_rmv.html:h}
+                        {form.remove_img_rmv.label:h}
+                    </label>
 
-                <i>{form.curr_image.label:h}</i>
-                {form.curr_image.html:h}
+                    <i>{form.curr_image.label:h}</i>
+                    {form.curr_image.html:h}
+                </div>
+                <i>{form.image.label:h}</i>
+                <div flexy:if="form.image.error" class="req">
+                    {form.image.error:h}
+                </div>
+                {form.image.html:h}
             </div>
-            <i>{form.image.label:h}</i>
-            <div flexy:if="form.image.error" class="req">
-                {form.image.error:h}
-            </div>
-            {form.image.html:h}
-        </div>
-        <div class="courseSection">
-            <i>{form.res_url.label:h}</i>
-            <div flexy:if="form.res_url.error" class="req">{form.res_url.error:h}</div>
-            {form.res_url.html:h}
+            <div class="courseSection">
+                <i>{form.res_url.label:h}</i>
+                <div flexy:if="form.res_url.error" class="req">{form.res_url.error:h}</div>
+                {form.res_url.html:h}
 
 
-            <i>{form.par.label:h}</i>
-            <div flexy:if="form.par.error" class="req">{form.par.error:h}</div>
-            {form.par.html:h}
+                <i>{form.par.label:h}</i>
+                <div flexy:if="form.par.error" class="req">{form.par.error:h}</div>
+                {form.par.html:h}
 
-            <i>{form.yardage.label:h}</i>
-            <div flexy:if="form.yardage.error" class="req">{form.yardage.error:h}</div>
-            {form.yardage.html:h}
+                <i>{form.yardage.label:h}</i>
+                <div flexy:if="form.yardage.error" class="req">{form.yardage.error:h}</div>
+                {form.yardage.html:h}
 
-            <i>{form.course_rating.label:h}</i>
-            <div flexy:if="form.course_rating.error" class="req">{form.course_rating.error:h}</div>
-            {form.course_rating.html:h}
+                <i>{form.course_rating.label:h}</i>
+                <div flexy:if="form.course_rating.error" class="req">{form.course_rating.error:h}</div>
+                {form.course_rating.html:h}
 
-            <i>{form.slope_rating.label:h}</i>
-            <div flexy:if="form.slope_rating.error" class="req">{form.slope_rating.error:h}</div>
-            {form.slope_rating.html:h}
+                <i>{form.slope_rating.label:h}</i>
+                <div flexy:if="form.slope_rating.error" class="req">{form.slope_rating.error:h}</div>
+                {form.slope_rating.html:h}
 
-            <i>{form.walking_course.label:h}</i>
-            <div flexy:if="form.walking_course.error" class="req">{form.walking_course.error:h}</div>
-            {form.walking_course.html:h}
+                <i>{form.walking_course.label:h}</i>
+                <div flexy:if="form.walking_course.error" class="req">{form.walking_course.error:h}</div>
+                {form.walking_course.html:h}
 
-            <i>{form.holes18.label:h}</i>
-            <div flexy:if="form.holes18.error" class="req">{form.holes18.error:h}</div>
-            {form.holes18.html:h}
+                <i>{form.holes18.label:h}</i>
+                <div flexy:if="form.holes18.error" class="req">{form.holes18.error:h}</div>
+                {form.holes18.html:h}
 
-            <i>{form.holes9.label:h}</i>
-            <div flexy:if="form.holes9.error" class="req">{form.holes9.error:h}</div>
-            {form.holes9.html:h}
+                <i>{form.holes9.label:h}</i>
+                <div flexy:if="form.holes9.error" class="req">{form.holes9.error:h}</div>
+                {form.holes9.html:h}
 
-        </div>
-        <div class="coursePhoto">
-            <div flexy:if="showCurrFile">
-                <label>
-                    {form.remove_file_rmv.html:h}
-                    {form.remove_file_rmv.label:h}
-                </label>
+            </div>
+            <div class="coursePhoto">
+                <div flexy:if="showCurrFile">
+                    <label>
+                        {form.remove_file_rmv.html:h}
+                        {form.remove_file_rmv.label:h}
+                    </label>
 
-                <i>{form.curr_file.label:h}</i>
-                {form.curr_file.html:h}
+                    <i>{form.curr_file.label:h}</i>
+                    {form.curr_file.html:h}
+                </div>
+                <i>{form.file.label:h}</i>
+                <div flexy:if="form.file.error" class="req">
+                    {form.file.error:h}
+                </div>
+                {form.file.html:h}
             </div>
-            <i>{form.file.label:h}</i>
-            <div flexy:if="form.file.error" class="req">
-                {form.file.error:h}
+            <div class="submitArea">
+                {form.add_rmv.html:h}
+                {form.remove_rmv.html:h}
             </div>
-            {form.file.html:h}
-        </div>
-        <div class="submitArea">
-            {form.add_rmv.html:h}
-            {form.remove_rmv.html:h}
-        </div>
-    </form>
+        </form>
+    </div>
 </div>
index 65a7a4c..dea67c3 100644 (file)
         </div>
     {end:}
     <h1>Courses</h1>
-    {uploadForm:h}
     <div id="packageList" class="container">
-    {foreach:editForm,i}
-        {i:h}
-    {end:}
+        <div id="courseAddForm" class="group">
+            <h3>Add New Course</h3>
+            {uploadForm:h}
+        </div>
+        {foreach:editForm,i}
+            {i:h}
+        {end:}
     </div>
 </div><!-- /#member-info -->