Skip to content

Conversation

@dgrammatiko
Copy link
Contributor

Fixes an error on Admin side for Finder #5018

Bug report here

Test instructions

Ensure you have content (ideally sample data)

  1. Components -> Smart Search -> Search filters.
  2. Click on New to create a new filter.

Check your browsers console for js error

  1. Apply this patch

Re check your browser
Check functionality

Side note

Finder is totally dependent on mootools and this has to change somehow...

@dgrammatiko
Copy link
Contributor Author

This thing that Jissues constantly changes the description of the PR is totally annoying. Anyhow, there is one more thing with this PR:
~~##### The slider effect does NOT work therefore:

  1. the first box, where someone was supposed to select the filter branch, is now hidden
  2. the rendered output is a bunch of boxes
  3. if we are about to fix this we need to redesign the page (or rewrite the component) and use jQuery!~~

@chrisdavenport
Copy link
Contributor

@test. Failed. First box is missing or hidden. Other boxes (which are supposed to be hidden initially, then slide out when selected from the first box) are shown.

@dgrammatiko
Copy link
Contributor Author

@chrisdavenport The change of behavior was intended, please read my comment above.

@chrisdavenport
Copy link
Contributor

@DGT41 Sorry, I thought you were describing how it was failing, not how you were changing its behaviour! My bad.

Okay, functionally it seems to work, but there do seem to be display issues. When I first go in to create a new filter, all the boxes are displayed vertically without borders, but when I save a new filter then go back in to edit it, the boxes are displayed in rows of 2 and the last box has a right border and a horizontal scroll-bar. Can you make it look a bit prettier? Maybe just use more of the available screen space and restore the box borders?

Tested in Firefox and Chrome on Ubuntu 14.04.

@dgrammatiko
Copy link
Contributor Author

@chrisdavenport No prob. I think it is waste of time to try to correct this outdated code, thus I propose to move it altogether to jquery. Anyway I comment out some more lines in the script and placed a border around every filter box. Here is a quick render:
screen shot 2014-11-15 at 2 06 32

@chrisdavenport
Copy link
Contributor

@test Fixes the issue. Thanks.

A PR for moving to jQuery would be welcome. However, the priority right now is to get the current code to work properly since this bug is a release blocker for 3.4.

@dgrammatiko
Copy link
Contributor Author

@chrisdavenport I know this is a dirty quick patch, but it might be helpful!

@spignataro
Copy link
Contributor

I know this is more of house keeping than anything else - but if we comment lines of code out - shouldn't these lines not be included in the PR? It will be there historically in the GIT repo. Just a suggestion.

@dgrammatiko
Copy link
Contributor Author

@chrisdavenport @spignataro OK I think this one is a better solution, as it restores the previous functionality!
Personally speaking I don’t like the old behavior (the slide effect), I prefer the many boxes edition...

@chrisdavenport
Copy link
Contributor

The "Select All" checkbox doesn't work.

Hmm. I agree that the slide effect is not really good and we should just drop it. It causes problems and you've proved that it isn't really required. I also suspect that it would not work well for RTL languages.

It's also less JavaScript to maintain (and convert to jQuery) if we just get rid of it.

@dgrammatiko
Copy link
Contributor Author

@chrisdavenport It’s your decision what will make it to Joomla. Picking the first two commits, you’ll get the plain boxes, applying all 3 you'll get the slide effect as well...

@chrisdavenport
Copy link
Contributor

Not just my decision. Personally, I'd go with just the plain boxes.

@chrisdavenport
Copy link
Contributor

@DGT41 Since no-one else has commented to the contrary, I'm going to make the decision and say we should go with the plain boxes and forget the slide effect. Can you adjust the PR to reflect that?

@dgrammatiko
Copy link
Contributor Author

@chrisdavenport Chris I did the changes here, also as you can see I also changed the way that slider finder.js is injected in order to make sure that behavior.framework is also called components/com_finder/helpers/html/filter.php. This was broken on the last changes moving the back end to jquery, so this PR right now patches two bugs 😄

@chrisdavenport
Copy link
Contributor

@DGT41 There is a new problem with this PR:

  1. Click New to create a new filter.
  2. Tick a few checkboxes but do NOT enter a title.
  3. Click Save and Close. You should get a warning about the missing title.
  4. Fill in the title field and click Save and Close again.
  5. Filter is saved but is listed as having a map count of 0 and indeed no filter settings were saved.

@dgrammatiko
Copy link
Contributor Author

@chrisdavenport Confirmed. The problem for this instance is that there is no client side validation on the title, so data is sent to server -> will not validate thus not saved -> form will reload with empty (not selected) fields. Also changing line 12 @ /administrator/com_finder/views/filter/tmpl/default.php to

JHtml::_('behavior.formvalidation');

which was the prior code here gives the same result, thus this is not a new problem. Anyways I am gonna try to find a way around it...

@dgrammatiko
Copy link
Contributor Author

@chrisdavenport Done! Client side validation is activated

@smanzi
Copy link

smanzi commented Dec 10, 2014

@DGT41: try my solution (also not inline...): it is Cascading Style Sheets...

@dgrammatiko
Copy link
Contributor Author

@smanzi we are on the same page here

@smanzi
Copy link

smanzi commented Dec 10, 2014

@DGT41 no prob: last attribute declared takes precedence if understood...

@smanzi
Copy link

smanzi commented Dec 10, 2014

I still can't test with IE8, but it seems that the info that overflow-x and overflow-y are not supported by IE8 is false. Anyway at http://reference.sitepoint.com/css/overflow we have:

Internet Explorer version 8 has a variety of bugs when overflow is combined with max-width or max-height and you can find a series of test cases documented at the Hilbrand Edskes site.

@smanzi
Copy link

smanzi commented Dec 10, 2014

and at http://www.w3schools.com/jsref/prop_style_overflowx.asp

Note: The overflowX property does not work properly in IE8 and earlier.

@infograf768
Copy link
Member

From Microsoft:

http://msdn.microsoft.com/en-us/library/ie/ms530826%28v=vs.85%29.aspx

Remarks

Windows Internet Explorer 8. The -ms-overflow-x attribute is an extension to CSS, and can be used as a synonym for overflow-x in IE8 Standards mode. "

@smanzi
Copy link

smanzi commented Dec 10, 2014

@infograf768 my reading is that you can use both: either -ms-overflow-x or overflow-x... correct?

@infograf768
Copy link
Member

Mine is that we should be careful and do as was proposed above. AND test in IE8.

.checklist {
    border: 1px solid #ccc;
    height: 220px;
    overflow: auto;
    width: 220px;
    float: left;
    margin: 0;
    overflow-x: hidden;
    -ms-overflow-y: auto;
    -ms-overflow-x: hidden;
}

@smanzi
Copy link

smanzi commented Dec 10, 2014

test... for sure! 😄 Damn, do I have to install a Windows XP VM??

@dgrammatiko
Copy link
Contributor Author

@infograf768 This works fine here

.checklist {
    border: 1px solid #ccc;
    height: 220px;
    overflow: auto;
    width: 220px;
    float: left;
    margin: 0;
    overflow-x: hidden;
    -ms-overflow-y: auto;
    -ms-overflow-x: hidden;
}

untitled

@infograf768
Copy link
Member

Could someone look at making finder rtl aware?
We could have a single rtl.css file for it that would be loaded when the ltr default css are, and after these, in order to correct some stuff>

For example here in the case of .checklist, we would need a float: right;

@chrisdavenport
Copy link
Contributor

Should be possible. That was one reason I favoured dropping the sliders. Needs a front-ender to look into it. I suggest opening a separate issue.

@dgrammatiko
Copy link
Contributor Author

@infograf768 @chrisdavenport is this acceptable:

if (JFactory::getDocument()->direction == 'rtl')
{
    JFactory::getDocument()->addStyleDeclaration('
.checklist, .checklist dd, #branch-selectors dd, .checklist div.control-group, #branch-selectors div.control-group { text-align: right; }
dl.checklist.dt.label.checkbox { text-align: center; }
.radio input[type="radio"], .checkbox input[type="checkbox"] { float: left; margin-right: 5px; left: 5px;}
');
}

preview:
screen shot 2014-12-10 at 8 38 44

@infograf768
Copy link
Member

Personnaly, I prefer full stylesheet as it is easy to correct/add
something like (concerning filters only):

diff --git a/components/com_finder/helpers/html/filter.php b/components/com_finder/helpers/html/filter.php
index 6d6c70c..6049bee 100644
--- a/components/com_finder/helpers/html/filter.php
+++ b/components/com_finder/helpers/html/filter.php
@@ -115,5 +115,10 @@
        {
            JHtml::_('stylesheet', 'com_finder/sliderfilter.css', false, true, false);
-           JHtml::_('script', 'com_finder/sliderfilter.js', false, true);
+           
+           if (JFactory::getDocument()->direction == 'rtl')
+           {
+               JHtml::_('stylesheet', 'com_finder/finder-rtl.css', false, true, false);
+           }
+           JHtml::_('script', 'com_finder/sliderfilter.js', true, true);
        }

@@ -433,4 +438,9 @@
        {
            JHtml::stylesheet('com_finder/sliderfilter.css', false, true, false);
+           
+           if (JFactory::getDocument()->direction == 'rtl')
+           {
+               JHtml::_('stylesheet', 'com_finder/finder-rtl.css', false, true, false);
+           }
        }

diff --git a/media/com_finder/css/finder-rtl.css b/media/com_finder/css/finder-rtl.css
new file mode 100644
index 0000000..c82097d
--- /dev/null
+++ b/media/com_finder/css/finder-rtl.css
@@ -0,0 +1,27 @@
+.checklist {
+   float: right;
+}
+
+.checklist {
+   border-right-width: 0;
+}
+
+#filter_lists div {
+   float: right;
+}
+
+.checklist dt,
+#branch-selectors dt {
+   padding: 0 2px 2px 0;
+   text-align: right;
+}
+
+.checklist,
+.checklist dd,
+#branch-selectors dd,
+.checklist div.control-group,
+#branch-selectors div.control-group {
+   padding: 0 2px 0 0;
+   text-align: right;
+}
+

@infograf768
Copy link
Member

Which gives:
screen shot 2014-12-11 at 10 20 05

@dgrammatiko
Copy link
Contributor Author

@infograf768 Just added rtl support per your request

@infograf768
Copy link
Member

There are 2 places in that file where the rtl.css has to be added (see above)
Also, any reason to move the place where we load the js file ?

@dgrammatiko
Copy link
Contributor Author

My thought was that this js was only used in here, maybe I am wrong...

@infograf768
Copy link
Member

For me, its fine now.
(other rtl stuff, concerning frontend for example, can be added later.

One more tester.

@waader
Copy link
Contributor

waader commented Dec 11, 2014

@test works for me!

@infograf768 infograf768 added the RTC This Pull Request is Ready To Commit label Dec 11, 2014
@infograf768 infograf768 added this to the Joomla! 3.4.0 milestone Dec 11, 2014
@wilsonge
Copy link
Contributor

Fixed with 6fb8834

@wilsonge wilsonge closed this Dec 11, 2014
@dgrammatiko dgrammatiko deleted the _js_Finder_error branch December 11, 2014 15:20
@zero-24 zero-24 removed the RTC This Pull Request is Ready To Commit label Oct 14, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants