Skip to content

Commit

Permalink
Dev: sub menu for question index
Browse files Browse the repository at this point in the history
Dev: little hack, add a .dropdown-menu .dropdown-sub-menu to surclass .dropdown-menu .dropdown-menu
Dev: can use .dropdown-menu .dropdown-menu in css , but more clear with a new class
  • Loading branch information
Shnoulle committed Oct 28, 2016
1 parent b749083 commit c35c06f
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 21 deletions.
8 changes: 7 additions & 1 deletion application/core/packages/limesurvey/survey.css
Expand Up @@ -109,4 +109,10 @@
border-bottom-right-radius: 0;
margin-bottom: -1px;
}
/* survey list : only in template ? */
/* dropdown-sub-menu for question index : no ls specific, then no ls- template can use it easily */
.dropdown-menu .dropdown-sub-menu{
display:block;
position:relative;
float:none;
box-shadow: 0 0 0 #fff;
}
Expand Up @@ -12,27 +12,27 @@
</a>
<ul class="dropdown-menu">
<?php foreach($indexItems as $group): ?>
<?php if(!empty($first)): ?>
<li class="divider" role="separator"></li>
<?php else: ?>
<?php $first=true; ?>
<?php endif; ?>
<li class="dropdown-header">
<?php echo viewHelper::flatEllipsizeText($group['text'],true,30," &hellip; ",0.6); ?>
<li>
<div class="dropdown-header">
<?php echo viewHelper::flatEllipsizeText($group['text'],true,30," &hellip; ",0.6); ?>
<span class="caret"></span>
</div>
<ul class="dropdown-menu dropdown-sub-menu">
<?php foreach($group['questions'] as $step=>$indexItem): ?>
<?php
/* bs class for testing : bg-danger is really great here, but only if menu is set in navigator or after */
$statusClass = $indexItem['stepStatus']['index-item-unanswered']? " bg-warning":"";
$statusClass.= $indexItem['stepStatus']['index-item-error']? " bg-danger":"";
$statusClass.= $indexItem['stepStatus']['index-item-current']? " disabled":"";
?>
<li class="<?php echo $indexItem['coreClass']; ?><?php echo $statusClass; ?>">
<a href='<?php echo $indexItem['url']; ?>' data-limesurvey-submit='<?php echo $indexItem['submit']; ?>'>
<?php echo viewHelper::flatEllipsizeText($indexItem['text'],true,30," &hellip; ",0.6); ?>
</a>
</li>
<?php endforeach;?>
</ul>
</li>
<?php foreach($group['questions'] as $step=>$indexItem): ?>
<?php
/* bs class for testing : bg-danger is really great here, but only if menu is set in navigator or after */
$statusClass = $indexItem['stepStatus']['index-item-unanswered']? " bg-warning":"";
$statusClass.= $indexItem['stepStatus']['index-item-error']? " bg-danger":"";
$statusClass.= $indexItem['stepStatus']['index-item-current']? " disabled":"";
?>
<li class="<?php echo $indexItem['coreClass']; ?><?php echo $statusClass; ?>">
<a href='<?php echo $indexItem['url']; ?>' data-limesurvey-submit='<?php echo $indexItem['submit']; ?>'>
<?php echo viewHelper::flatEllipsizeText($indexItem['text'],true,30," &hellip; ",0.6); ?>
</a>
</li>
<?php endforeach;?>
<?php endforeach;?>
</ul>
</li>
Expand Down

15 comments on commit c35c06f

@olleharstedt
Copy link
Contributor

@olleharstedt olleharstedt commented on c35c06f Oct 29, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated question: How come some question types has timer, some don't? Seems like only text and list questions have timer (using return_timer_script in qanda).

@Shnoulle
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, surely due to limited script (yo set 'readonly') at creation of the system. And surely the dev want it only for this question type (if i remind : we only have 'short text' during some month).
https://github.com/LimeSurvey/LimeSurvey/blob/master/application/helpers/questionHelper.php#L1083

@olleharstedt
Copy link
Contributor

@olleharstedt olleharstedt commented on c35c06f Oct 29, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need a new concept, something like "question extension", for stuff like timer, since it's not a single attribute, but rather a "package" of attributes that must be defined together.

@Shnoulle
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I already said a lot : it's easy to remove timer from core attribute and create a new plugin.

In fact : event newQuestionAttributes happen only one time : the question attribute is more something like question extensions :)

@olleharstedt
Copy link
Contributor

@olleharstedt olleharstedt commented on c35c06f Oct 29, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, but too many plugins can make the system confusing for users. If we have a question manager in the future, we can show two tabs: question types/modules, and question "extensions" or whatever to call it.

Edit: Or maybe rename plugin manager to "extension manager", and let it include plugins, question modules and question extensions.

@Shnoulle
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 for the Edit . And for tabs : think if we use "own tab name" in question attribute : it create a new tab name => already fixed (for survey manager)

@olleharstedt
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

think if we use "own tab name" in question attribute : it create a new tab name

Yes, that would be nice, too. I will check how it works.

@Shnoulle
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In fact : i'm sure it's this behaviour ;)

@LouisGac
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Timer is not related to the object question. It's related to the object navigation.

@Shnoulle
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe , but currently it's a Question Attribute.

@LouisGac
Copy link
Contributor

@LouisGac LouisGac commented on c35c06f Oct 31, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's why it's a conception bug. Timer applies to a question only when navigation is set to "question by question". When moving to "group by group" or to "all in one" it makes no sense.

That's why we need a real navigation component, handling everything related to the navigation, like timer.

Today, the Expression Manager handle two tasks:

  • Question validation
  • Navigation

When we'll create the question classes, and when question object will handle the question validation, the "lefting" part of the EM will be indeed the navigation component, which will include among other things timer.

@Shnoulle
Copy link
Collaborator Author

@Shnoulle Shnoulle commented on c35c06f Oct 31, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When moving to "group by group" or to "all in one" it makes no sense.

No, i'm not OK about this sentence :

  1. Question can be deactivated
  2. You can choose to submit whole group with only one question (it work in 2.06)

@LouisGac
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and what happen if 3 questions in a group has 3 timers with different values?
The fact that in 2.x timer works using tricks doesn't prove that timer is at the right place. In LimeSurvey, not everything is questions: Timer is related to navigation, no to question. It could even be a data attribute attached to the submit button.
That's why before doing a huge refactoring of LimeSurvey, we must first agree on all the object that composed the application, to clearly separate them in different components.

@Shnoulle
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then 2 different timer needed : right ?

  1. set relevance to 0 after X seconds after the first viewing : always fill bull in DB
  2. move timer : attached to 'step'

right ?

@LouisGac
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only one timer, related to navigation.

Then, if a question should have a particular behavior based on navigation, the question should be able to read the state of timer to do what it want.

Each object is in charge of its own state: that the most basic and most important part of object design.
Replace timer by a traffic light and questions by cars: would you say that each car should have its own traffic light to be able to interact with it?

Please sign in to comment.